Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when adding FormatJS SWC Plugin #75108

Open
rubanooo opened this issue Jan 20, 2025 · 0 comments
Open

Error when adding FormatJS SWC Plugin #75108

rubanooo opened this issue Jan 20, 2025 · 0 comments
Labels
SWC Related to minification/transpilation in Next.js.

Comments

@rubanooo
Copy link

Link to the code that reproduces this issue

https://github.com/rubanooo/next-swc-formatjs-error

To Reproduce

  1. Install the SWC plugin
  2. Add to the next config with the following format:
import type { NextConfig } from "next";

const nextConfig: NextConfig = {
  /* config options here */
  experimental: {
    swcPlugins: [
      ['@swc/plugin-formatjs', {}]
    ]
  }
};

export default nextConfig;
  1. Run the dev server

Current vs. Expected behavior

Following the 3 steps, I expect the server to not panic at least

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.2.0: Fri Dec  6 19:01:59 PST 2024; root:xnu-11215.61.5~2/RELEASE_ARM64_T6000
  Available memory (MB): 16384
  Available CPU cores: 10
Binaries:
  Node: 20.14.0
  npm: 10.7.0
  Yarn: N/A
  pnpm: 9.15.2
Relevant Packages:
  next: 15.1.5 // Latest available version is detected (15.1.5).
  eslint-config-next: N/A
  react: 19.0.0
  react-dom: 19.0.0
  typescript: N/A
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

SWC

Which stage(s) are affected? (Select all that apply)

next dev (local), next build (local), next start (local)

Additional context

The error message when using turbopack:

Panic: panicked at turbopack/crates/turbopack-swc-utils/src/emitter.rs:52:13:
IssueCollector and IssueEmitter were dropped without calling `collector.emit().await?`
Backtrace:    0: _napi_register_module_v1
   1: <unknown>
   2: _napi_register_module_v1
   3: _napi_register_module_v1
   4: _napi_register_module_v1
   5: _napi_register_module_v1
   6: _napi_register_module_v1
   7: _BrotliDecoderVersion
   8: _BrotliDecoderVersion
   9: _BrotliDecoderVersion
  10: _BrotliDecoderVersion
  11: <unknown>
  12: <unknown>
  13: <unknown>
  14: <unknown>
  15: <unknown>
  16: <unknown>
  17: <unknown>
  18: <unknown>
  19: <unknown>
  20: <unknown>
  21: <unknown>
  22: _napi_register_module_v1
  23: _napi_register_module_v1
  24: _napi_register_module_v1
  25: _napi_register_module_v1
  26: _napi_register_module_v1
  27: _napi_register_module_v1
  28: _napi_register_module_v1
  29: _napi_register_module_v1
  30: _napi_register_module_v1
  31: _napi_register_module_v1
  32: _napi_register_module_v1
  33: _napi_register_module_v1
  34: _napi_register_module_v1
  35: __pthread_deallocate

The error message when not using turbopack:

Panic: panicked at /Users/geist/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc-5.0.2/src/plugin.rs:169:14:
failed to invoke plugin: failed to invoke plugin on 'Some("/Users/ruben/Code/tosize/next-swc-formatjs-error/src/app/layout.tsx")'

Caused by:
    0: failed to invoke `/Users/ruben/Code/tosize/next-swc-formatjs-error/node_modules/.pnpm/@[email protected]/node_modules/@swc/plugin-formatjs/swc_plugin_formatjs.wasm` as js transform plugin at /Users/ruben/Code/tosize/next-swc-formatjs-error/node_modules/.pnpm/@[email protected]/node_modules/@swc/plugin-formatjs/swc_plugin_formatjs.wasm
    1: wasm plugin bytecheck failed "check bytes error: check failed for tuple struct member 0: check failed for struct member pkg_version: pointer out of bounds: base 0x4c246060b98 offset -51922 not in range 0x4c246060a00..0x4c246060bb4"
Backtrace:    0: _napi_register_module_v1
   1: <unknown>
   2: _napi_register_module_v1
   3: _napi_register_module_v1
   4: _napi_register_module_v1
   5: _napi_register_module_v1
   6: _napi_register_module_v1
   7: _napi_register_module_v1
   8: _BrotliDecoderVersion
   9: _BrotliDecoderVersion
  10: <unknown>
  11: <unknown>
  12: _BrotliDecoderVersion
  13: _BrotliDecoderVersion
  14: _BrotliDecoderVersion
  15: _BrotliDecoderVersion
  16: _BrotliDecoderVersion
  17: <unknown>
  18: <unknown>
  19: <unknown>
  20: <unknown>
  21: <unknown>
  22: <unknown>
  23: <unknown>

---------------------------
Panic: panicked at /Users/geist/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc-5.0.2/src/plugin.rs:169:14:
failed to invoke plugin: failed to invoke plugin on 'Some("/Users/ruben/Code/tosize/next-swc-formatjs-error/node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/next/dist/pages/_app.js")'

Caused by:
    0: failed to invoke `/Users/ruben/Code/tosize/next-swc-formatjs-error/node_modules/.pnpm/@[email protected]/node_modules/@swc/plugin-formatjs/swc_plugin_formatjs.wasm` as js transform plugin at /Users/ruben/Code/tosize/next-swc-formatjs-error/node_modules/.pnpm/@[email protected]/node_modules/@swc/plugin-formatjs/swc_plugin_formatjs.wasm
    1: wasm plugin bytecheck failed "check bytes error: check failed for tuple struct member 0: check failed for struct member pkg_version: pointer out of bounds: base 0x4c248081198 offset -51922 not in range 0x4c248081000..0x4c2480811b4"
Backtrace:    0: _napi_register_module_v1
   1: <unknown>
   2: _napi_register_module_v1
   3: _napi_register_module_v1
   4: _napi_register_module_v1
   5: _napi_register_module_v1
   6: _napi_register_module_v1
   7: _napi_register_module_v1
   8: _BrotliDecoderVersion
   9: _BrotliDecoderVersion
  10: <unknown>
  11: <unknown>
  12: _BrotliDecoderVersion
  13: _BrotliDecoderVersion
  14: _BrotliDecoderVersion
  15: _BrotliDecoderVersion
  16: _BrotliDecoderVersion
  17: <unknown>
  18: <unknown>
  19: <unknown>
  20: <unknown>
  21: <unknown>
  22: <unknown>
  23: <unknown>
@github-actions github-actions bot added the SWC Related to minification/transpilation in Next.js. label Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SWC Related to minification/transpilation in Next.js.
Projects
None yet
Development

No branches or pull requests

1 participant