Skip to content

Remove JS-based loader bridge for SWC plugin of useExtracted to further improve transform performance #2187

Description

@amannn

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!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions