-
Notifications
You must be signed in to change notification settings - Fork 28k
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
build: Update swc_core
to v0.86.40
and update turbopack
#57904
Conversation
I'm working to verify if |
Tests Passed |
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
Next Runtimes
|
We need to wait for swc-project/swc#8205 before merging this to prevent #55682 from occurring again |
This reverts commit d05086a.
This reverts commit 3add9bf.
) **Description:** Note: Preserving native names is a hack, but it's used by `terser` and it's the only way to preserve the name of `class AbortSignal` while mangling without `keep_classnames: true`. We can special case `AbortSignal`, but let's just follow `terser`. **Related issue:** - vercel/next.js#57904
**Related issue:** - vercel/next.js#57904 (CI failed)
I assumed the CI is flaky, but I found that the CI failure is a source map regression of the SWC minifier. ![]() d05086a does not update |
investigationIt was not a regression. The test was wrong. It should not rely on the class name on production build. |
@@ -167,7 +167,7 @@ describe('Application Export Intent Output', () => { | |||
|
|||
it('should build and export', async () => { | |||
const result = await nextBuild(appDir, [], { stderr: true }) | |||
expect(result.stderr).toMatch('A.getInitialProps()') | |||
expect(result.stderr).toMatch('.getInitialProps()') |
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.
I found that #57085 added this, but this should fail on the production builds. We should not preserve class names for production (10% size regression if we do so).
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.
Due to a regression I introduced before #57085 it was not detected, and this PR includes fixes for the regression.
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.
cc @styfle
### Description This PR is required to apply vercel/next.js#57904 in next.js ### Testing Instructions Let's look at the CI of next.js
swc_core
to v0.86.40
swc_core
to v0.86.40
& turbopack
swc_core
to v0.86.40
& turbopackswc_core
to v0.86.40
and update turbopack
**Description:** Regarding vercel/next.js#55682, I made a mistake while investigating. I assumed it's `swcMinify`-only but it seems like `node-fetch` is fundamentally incompatible with our minification options. I thought `node-fetch` works with terser, but it did not, and it **should not**. But as I thought `terser` works, I assumed that `terser` has a hack for `AbortSignal`. And that's how I fixed `swcMinify: true`. The correct fix is `keep_classnames: true` but it will result in +~10% bundle size bloat. At first, I used the correct way (`keep_classnames: true`), but it resulted in the bundle size bloat, so I mimicked the hack of terser with vercel/next.js#57904. While working on other minification issues, I found that there's no such hack in `terser` and I need to remove the hack in the SWC minifier. The repro in vercel/next.js#55682 does not work with `swcMinify: false`, even with next@14. The problem of minifier and node-fetch was not exploited before `serverMinification: true`. **Related issue:** - brix/crypto-js#415
What?
VersionedContent
onEcmascriptBuildNodeChunkContent
turborepo#6354swc_core
tov0.86.40
turborepo#6343Update
swc_core
tov0.86.40
Revert Pass same mangling option as terser to SWC minifier #56281 and fix
node-fetch
by disabling inlininginline: 2
instead ofkeep_fnames: true
Why?
keep_fnames
increases the bundle size too much.How?
Fixes Problem With OpenAPI Private Identifiers #56612
Fixes NextJs does not minify React Components anymore #57886
Fixes Minification causes "TypeError: Expected signal to be an instanceof AbortSignal" error with NextJS 13.5 + Azure Blob Storage 12.16.0 #55682 (by feat(es/minifier): Respect inline level and preserve native names swc-project/swc#8205)
Reverts Pass same mangling option as terser to SWC minifier #56281
Closes PACK-1902