-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Provide the optimization plugin for Next.js #9762
Comments
Hey @kaorun343! The SWC issue is indeed quite a complex topic, read swc-project/swc#8315 for more context.
Unfortuntely, that's not possible, We can't simply port it, or wrap it for Next.js usage, SWC and Babel are completely different compilers, not just with language differences, but underlying architectural design. |
Hi, @YassinEldeeb! Thanks for your reply! 👍 I checked the other packages that provides plugins for Next.js, and I found they uses babel internally. So, it might be possible to do so, I think.
They seems setting their original webpack loader in |
Is your feature request related to a problem? Please describe.
The Current SWC plugin doesn't work well with recent Next.js.
In order to reduce bundle size in Next.js application, we have to use its babel plugin so we have to put custom babel config file, which disables SWC compiler.
Describe the solution you'd like
My suggestion is providing the optimization plugin for Next.js, which wraps
babelOptimizerPlugin
.We don't have to care about SWC version mismatch.
Also, we don't have to prepare custom babel config file, so we can still get benefits from Next.js's SWC compiler.
(I'm not familier with Next.js plugin system, so this explanation might be wrong.)
Describe alternatives you've considered
No response
Is your feature request related to a problem? Please describe.
The text was updated successfully, but these errors were encountered: