Describe the bug
Fresh next js + react compiler + @swc/plugin-formatjs build breaks with a build error.
URL to minimal reproduction
https://github.com/meltuhamy/next-swc-formatjs-reactcompiler-bug
- Start a fresh next app (
npx create-next-app@latest) and when prompted turn on React Compiler (or just use this repo)
npm install @swc/plugin-formatjs react-intl
- Add
reactCompiler: true, output: 'export' and experimental: { swcPlugins: [["@swc/plugin-formatjs", { ast: true }]]} to the next config.
- Update
page.tsx to use several translated messages (note: it will work with 1 or 2 translated strings, but starts breaking with more messages). I've included an example page.tsx below.
- Run
npm run build
Example page.tsx:
"use client";
import { useIntl, IntlProvider } from "react-intl";
function Messages() {
const intl = useIntl();
return (
<ul>
<li>{intl.formatMessage({ id: "a", defaultMessage: "Message A" })}</li>
<li>{intl.formatMessage({ id: "b", defaultMessage: "Message B" })}</li>
<li>{intl.formatMessage({ id: "c", defaultMessage: "Message C" })}</li>
<li>{intl.formatMessage({ id: "d", defaultMessage: "Message D" })}</li>
<li>{intl.formatMessage({ id: "e", defaultMessage: "Message E" })}</li>
</ul>
);
}
export default function Page() {
return (
<IntlProvider locale="en" messages={{}}>
<Messages />
</IntlProvider>
);
}
Expected behavior
The build should succeed without errors.
Actual behaviour
The build fails with the output below
npm run build
> next-swc-formatjs-reactcompiler-bug@0.1.0 build
> next build
▲ Next.js 16.2.1 (Turbopack)
- Experiments (use with caution):
· swcPlugins
Creating an optimized production build ...
thread '<unnamed>' panicked at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/swc_common-19.0.0/src/syntax_pos/hygiene.rs:425:14:
Should able to deserialize: failed to deserialize `swc_common::syntax_pos::hygiene::MutableMarkContext`
Caused by:
Eof { name: "u32", expect: Small(1) }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
> Build error occurred
Error: Turbopack build failed with 1 errors:
./src/app/page.tsx
Failed to execute SWC plugin
An unexpected error occurred when executing an SWC EcmaScript transform plugin.
This might be due to a version mismatch between the plugin and Next.js. https://plugins.swc.rs/ can help you find the correct plugin version to use.
Failed to execute @swc/plugin-formatjs
Caused by:
0: failed to run Wasm plugin transform. Please ensure the version of `swc_core` used by the plugin is compatible with the host runtime. See the documentation for compatibility information. If you are an author of the plugin, please update `swc_core` to the compatible version.
Note that if you want to use the os features like filesystem, you need to use `wasi`. Wasm itself does not have concept of filesystem.
https://swc.rs/docs/plugin/selecting-swc-core
See https://plugins.swc.rs/versions/from-plugin-runner/24.0.0 for the list of the compatible versions.
Build info:
Date: 2026-03-18
Timestamp: 2026-03-18T00:21:41.521826000Z
Version info:
swc_plugin_runner: 24.0.0
Dependencies: anyhow 1.0.100,blake3 1.5.4,parking_lot 0.12.3,rustc-hash 2.1.1,serde 1.0.228,serde_json 1.0.140,swc_atoms 9.0.0,swc_common 18.0.1,swc_plugin_proxy 20.0.0,swc_transform_common 12.0.0,tracing 0.1.41,vergen 9.0.0
1: RuntimeError: unreachable
Import traces:
Client Component Browser:
./src/app/page.tsx [Client Component Browser]
./src/app/page.tsx [Server Component]
Client Component SSR:
./src/app/page.tsx [Client Component SSR]
./src/app/page.tsx [Server Component]
at ignore-listed frames
Additional context
None
Describe the bug
Fresh next js + react compiler + @swc/plugin-formatjs build breaks with a build error.
URL to minimal reproduction
https://github.com/meltuhamy/next-swc-formatjs-reactcompiler-bug
npx create-next-app@latest) and when prompted turn on React Compiler (or just use this repo)npm install @swc/plugin-formatjs react-intlreactCompiler: true,output: 'export'andexperimental: { swcPlugins: [["@swc/plugin-formatjs", { ast: true }]]}to the next config.page.tsxto use several translated messages (note: it will work with 1 or 2 translated strings, but starts breaking with more messages). I've included an example page.tsx below.npm run buildExample
page.tsx:Expected behavior
The build should succeed without errors.
Actual behaviour
The build fails with the output below
Additional context
None