Replies: 1 comment
-
Any news here? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
Allow users to specify SWC's env option
Non-Goals
n/a
Background
The original SWC supports options equivalent to babel's preset-env and allows for specifying the
useBuiltIns
equivalent option undermode
.https://swc.rs/docs/configuration/swcrc#supported-browsers
However, Next.js sets SWC options internally, preventing framework users from configuring it directly. This constraint prevents me from safely using polyfills with the
usage
option and migrating to SWC.Proposal
There are several options, but for now, I prefer option 2.
Option 1. Enable specifying SWC options via .swcrc file
While I believe this is the most elegant solution, supporting .swcrc could have some impact, making it difficult to address immediately. There are some related issues on this matter, but no progress has been seen on them yet.
refs
Option 2. Add experimental support for
swcEnv
options and make them configurable in the next.configAdd the
swcEnv
orswcEnvMode
option as an experimental feature and pass the option to the following code.https://github.com/vercel/next.js/blob/canary/packages/next/src/build/swc/options.ts#L515
This change is minimal and has only a minor impact on existing users.
Beta Was this translation helpful? Give feedback.
All reactions