You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently tried to move from babel to SWC in one of my project, but noticed that I couldn't due to the fact that the SWC plugin for emotion does not have importMap support. In the current setup I have, emotion is re-exported and then used under the new export across the project.
This PR aims to add support for the `importMap` option for `emotion`. It's already supported by `swc_emotion`.
Fixes#41646.
## Feature
- [x] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`
Describe the feature you'd like to request
I recently tried to move from babel to SWC in one of my project, but noticed that I couldn't due to the fact that the SWC plugin for emotion does not have importMap support. In the current setup I have,
emotion
is re-exported and then used under the new export across the project.importMap makes that possible:
https://github.com/emotion-js/emotion/tree/main/packages/babel-plugin#importmap
Describe the solution you'd like
It looks like importMap support is already in the emotion plugin:
https://github.com/vercel/next.js/blob/canary/packages/next-swc/crates/emotion/src/import_map.rs
https://github.com/vercel/next.js/blob/canary/packages/next-swc/crates/emotion/tests/testImportMap.json
(Edit: These moved to here and here after #41613 was merged. Probably should've used a permalink, but w/e).
But the options are gated in the config:
next.js/packages/next/build/swc/options.js
Line 156 in 99d88f2
Is this an oversight or is there a specific reason for the importMap not being accepted as options to the emotion compiler settings?
Describe alternatives you've considered
node_modules/next/dist/build/swc/options.js
and set the importMap (which seems to work).The text was updated successfully, but these errors were encountered: