fix(es/minifier): Remove hack for built-in class names #8293
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
Regarding vercel/next.js#55682, I made a mistake while investigating. I assumed it's
swcMinify
-only but it seems likenode-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 thoughtterser
works, I assumed thatterser
has a hack forAbortSignal
. And that's how I fixedswcMinify: true
. The correct fix iskeep_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 beforeserverMinification: true
.Related issue: