Context
- SWC plugins require a compatible
swc_core runtime. Old plugins only work with specific swc_core versions.
- Latest
swc_core is backward-compatible, but no stable Next.js release uses it yet. Only @swc/core works reliably with backward-compatible plugins.
Current approach
next-intl uses a JS loader bridge with @swc/core to call SWC plugins from Next.js.
- Example:
next-intl depends on "@swc/core": "^1.15.2"; plugin compiled with swc_core = "47.0.3" — safe for now.
- This avoids breaking changes if Next.js upgrades
swc_core and drops support for older versions.
Why no direct Next.js integration yet
- Backward-compatible
swc_core exists in Next.js canary builds, but no stable release yet.
swcPlugins config is still experimental; full backward compatibility isn’t guaranteed.
- Upgrading Next.js patch could require
next-intl to upgrade swc_core, dropping support for older Next.js versions.
- Minor breaking changes for SWC plugins are expected currently
Conclusion
- The JS loader bridge is a temporary, safe solution.
- We’ll remove it once Next.js stabilizes backward-compatible SWC plugins and the
swcPlugins config.
References
Thanks to @kdy1 for the input here!
Context
swc_coreruntime. Old plugins only work with specificswc_coreversions.swc_coreis backward-compatible, but no stable Next.js release uses it yet. Only@swc/coreworks reliably with backward-compatible plugins.Current approach
next-intluses a JS loader bridge with@swc/coreto call SWC plugins from Next.js.next-intldepends on"@swc/core": "^1.15.2"; plugin compiled withswc_core = "47.0.3"— safe for now.swc_coreand drops support for older versions.Why no direct Next.js integration yet
swc_coreexists in Next.js canary builds, but no stable release yet.swcPluginsconfig is still experimental; full backward compatibility isn’t guaranteed.next-intlto upgradeswc_core, dropping support for older Next.js versions.Conclusion
swcPluginsconfig.References
Thanks to @kdy1 for the input here!