blitz-js / next-superjson-plugin

SuperJSON Plugin for Next.js Pages and Components
203 stars 13 forks source link

Nextjs 15 support #110

Open aplr opened 1 month ago

aplr commented 1 month ago

Verify Next.js canary release

Describe the bug

When running the build, I get the following issue. I guess swc_core has to be updated. Is this planned?

---------------------------
Panic: panicked at /Users/geist/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc-0.286.0/src/plugin.rs:169:14:
failed to invoke plugin: failed to invoke plugin on 'Some("/<nextjs>/node_modules/.pnpm/next@15.0.0-canary.183_@babel+core@7.25.2_@opentelemetry+api@1.9.0_react-dom@19.0.0-rc-70fb13_hsfjdoxlqarv5sl66waue4332e/node_modules/next/dist/pages/_document.js")'

Caused by:
    0: failed to invoke `/<nextjs>/node_modules/.pnpm/next-superjson-plugin@0.6.3_next@15.0.0-canary.183_@babel+core@7.25.2_@opentelemetry+api@1.9._6xagpm5pii5xovfhav3ur3hit4/node_modules/next-superjson-plugin/dist/next_superjson.wasm` as js transform plugin at /<nextjs>/node_modules/.pnpm/next-superjson-plugin@0.6.3_next@15.0.0-canary.183_@babel+core@7.25.2_@opentelemetry+api@1.9._6xagpm5pii5xovfhav3ur3hit4/node_modules/next-superjson-plugin/dist/next_superjson.wasm
    1: 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/0.112.2 for the list of the compatible versions.

                       Build info: 
                           Date: 2024-10-10
                           Timestamp: 2024-10-10T19:06:55.957638000Z

                       Version info: 
                           swc_plugin_runner: 0.112.2
                           Dependencies: anyhow 1.0.86,codspeed-criterion-compat 2.6.0,criterion 0.5.1,enumset 1.1.5,futures 0.3.30,once_cell 1.19.0,parking_lot 0.12.3,serde 1.0.209,serde_json 1.0.127,swc_atoms 0.6.7,swc_common 0.37.5,swc_css_ast 0.144.0,swc_css_parser 0.154.0,swc_ecma_ast 0.118.2,swc_ecma_loader 0.49.1,swc_ecma_parser 0.149.1,swc_ecma_visit 0.104.8,swc_malloc 0.5.11,swc_plugin_proxy 0.47.0,testing 0.39.0,tokio 1.40.0,tracing 0.1.40,vergen 9.0.0,virtual-fs 0.11.4,wasmer 4.3.5,wasmer-cache 4.3.5,wasmer-compiler-cranelift 4.3.5,wasmer-wasix 0.25.0

    2: RuntimeError: out of bounds memory access
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: _BrotliDecoderVersion
  12: _BrotliDecoderVersion
  13: _BrotliDecoderVersion
  14: _BrotliDecoderVersion
  15: _BrotliDecoderVersion
  16: <unknown>
  17: <unknown>
  18: <unknown>
  19: <unknown>
  20: <unknown>
  21: <unknown>
  22: <unknown>

Expected behavior

No build error

Reproduction link

No response

Version

0.6.3

Config

No response

Additional context

No response

LZL0 commented 1 month ago

Bumping now that NextJS 15 is out.

thereis commented 1 month ago

Facing this issue with Next 15.

serg-and commented 3 weeks ago

Next changed metadata causing this plugin to no longer work for page router bump this issue https://github.com/vercel/next.js/issues/72019

remorses commented 3 weeks ago

You can use this plugin instead as a temporary workaround https://github.com/remorses/next-superjson

This package always uses the same version of @swc/core so the SWC plugins continues to work, even if Next.js upgrades it, the plugin ships his own frozen version of SWC