Skip to content
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

fix(es/minifier): Remove hack for built-in class names #8293

Merged
merged 6 commits into from Nov 16, 2023

Conversation

kdy1
Copy link
Member

@kdy1 kdy1 commented Nov 15, 2023

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:

@kdy1 kdy1 added this to the Planned milestone Nov 15, 2023
@kdy1 kdy1 self-assigned this Nov 15, 2023
@kdy1
Copy link
Member Author

kdy1 commented Nov 15, 2023

Cause is #8205

@kdy1 kdy1 changed the title fix(es/minifier): Fix crypto-js fix(es/minifier): Remove hack for built-in class names Nov 15, 2023
Copy link
Member Author

@kdy1 kdy1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

swc-bump:

  • swc_ecma_transforms_base

@kdy1 kdy1 marked this pull request as ready for review November 15, 2023 23:30
@kdy1 kdy1 requested a review from a team as a code owner November 15, 2023 23:30
@kdy1 kdy1 merged commit 7985e02 into swc-project:main Nov 16, 2023
142 checks passed
@kdy1 kdy1 deleted the issue-cryptojs branch November 16, 2023 00:17
@kdy1 kdy1 modified the milestones: Planned, v1.3.98 Nov 21, 2023
@swc-project swc-project locked as resolved and limited conversation to collaborators Dec 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant