-
Notifications
You must be signed in to change notification settings - Fork 28.4k
fix(next-core): apply correct jsx transform context for ssr #57300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Stats from current PRDefault BuildGeneral
Client Bundles (main, webpack)
Legacy Client Bundles (polyfills)
Client Pages
Client Build Manifests
Rendered Page Sizes
Edge SSR bundle Size
Middleware size
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks correct to me.
// This enables correct emotion transform and other hydration between server and | ||
// client bundles. ref: https://github.com/vercel/next.js/blob/4bbf9b6c70d2aa4237defe2bebfa790cdb7e334e/packages/next/src/build/webpack-config.ts#L1421-L1426 | ||
let jsx_runtime_options = | ||
get_jsx_transform_options(project_path, mode, None, false, next_config); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be hoisted to the other call site?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can, but currently this is the only place needs this transform options while default transform options are hoisted. If there are other cases need this probably would do it.
Tests Passed |
What
Running
test/e2e/app-dir/emotion-js/index.test.ts
fails with turbopack as emotion skips necessary runtime transforms for the styles. Digging further, it was due to not applying correct importSource for the transform (@emotion/react
) against ssr component when running with turbopack. Peeking next-dev, we applyclient
side context if issuer layer origin is either ssr or pages for the browser while turbopack doesn't.PR uses
type
for the module context as equivalent to the issuer layer, and then apply client context for the transform for those modules.test/e2e/app-dir/emotion-js/index.test.ts
is passing with this PR.Closes WEB-1834