fixes #36763 fixes #36590 ## Feature - [x] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - It hasn't been accepted for implementation, although that process isn't clear, and this is a pretty trivial fix. - [x] Related issues linked using `fixes #number` - [x] Integration tests added - [x] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - This is somewhat inherent in the error log - [x] Errors have helpful link attached, see `contributing.md` ## Documentation / Examples - [x] Make sure the linting passes by running `yarn lint`
1.4 KiB
SWC disabled
Why This Message Occurred
Next.js now uses Rust-based compiler SWC to compile JavaScript/TypeScript. This new compiler is up to 17x faster than Babel when compiling individual files and up to 5x faster Fast Refresh.
Next.js provides full backwards compatibility with applications that have custom Babel configuration. All transformations that Next.js handles by default like styled-jsx and tree-shaking of getStaticProps
/ getStaticPaths
/ getServerSideProps
have been ported to Rust.
When an application has custom Babel configuration Next.js will automatically opt-out of using SWC for compiling JavaScript/Typescript and will fall back to using Babel in the same way that it was used in Next.js 11.
Many of the integrations with external libraries that currently require custom Babel transformations will be ported to Rust-based SWC transforms in the near future. These include but are not limited to:
- Emotion
In order to prioritize transforms that will help you adopt SWC please provide your .babelrc
on the feedback thread.
Possible Ways to Fix It
If you want to use SWC despite the presence of a .babelrc
file you can force it in your next.config.js
file.
// next.config.js
module.exports = {
experimental: {
forceSwcTransforms: true,
},
}