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

Nextjs 15 support #110

Open
1 task done
aplr opened this issue Oct 11, 2024 · 13 comments · May be fixed by #111
Open
1 task done

Nextjs 15 support #110

aplr opened this issue Oct 11, 2024 · 13 comments · May be fixed by #111
Labels
bug Something isn't working

Comments

@aplr
Copy link

aplr commented Oct 11, 2024

Verify Next.js canary release

  • I verified that the issue exists in the latest 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/[email protected]_@[email protected]_@[email protected][email protected]_hsfjdoxlqarv5sl66waue4332e/node_modules/next/dist/pages/_document.js")'

Caused by:
    0: failed to invoke `/<nextjs>/node_modules/.pnpm/[email protected][email protected]_@[email protected]_@[email protected]._6xagpm5pii5xovfhav3ur3hit4/node_modules/next-superjson-plugin/dist/next_superjson.wasm` as js transform plugin at /<nextjs>/node_modules/.pnpm/[email protected][email protected]_@[email protected]_@[email protected]._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

@aplr aplr added the bug Something isn't working label Oct 11, 2024
@LZL0
Copy link

LZL0 commented Oct 22, 2024

Bumping now that NextJS 15 is out.

@thereis
Copy link

thereis commented Oct 22, 2024

Facing this issue with Next 15.

@serg-and
Copy link

Next changed metadata causing this plugin to no longer work for page router
bump this issue vercel/next.js#72019

@remorses
Copy link

remorses commented Nov 1, 2024

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

@Andkoo
Copy link

Andkoo commented Nov 27, 2024

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

Doesn't work for me. Throws the exact same errors as next-superjson-plugin with "next": "^15.0.1", which is actually 15.0.3 according to yarn.lock.

@remorses
Copy link

@Andkoo you have to remove the swc plugins section in your next.config.js

@Andkoo
Copy link

Andkoo commented Nov 27, 2024

@Andkoo you have to remove the swc plugins section in your next.config.js

That was exactly the issue, figured it out right after posting the comment. It works now, thanks 🙏

@LZL0
Copy link

LZL0 commented Nov 27, 2024

@Andkoo you have to remove the swc plugins section in your next.config.js

This.

@kjetilhartveit
Copy link

kjetilhartveit commented Dec 17, 2024

https://github.com/remorses/next-superjson throws error Couldn't find a 'pages' directory. Please create one under the project root". Is app router not supported?

$ npx next dev
C:\Programming2\fantasy-snooker\node_modules\next-superjson\dist\index.js:68
    throw new Error("Couldn't find a `pages` directory. Please create one under the project root");
          ^

Error: Couldn't find a `pages` directory. Please create one under the project root
    at findPagesDir ({some path}\node_modules\next-superjson\dist\index.js:68:11)
    at applyTurbopackOptions ({some path}\node_modules\next-superjson\dist\index.js:78:20)
    at {some path}\node_modules\next-superjson\dist\index.js:24:9

@remorses
Copy link

App router already supports passing Dates and other non JSON values to client components, you don’t need this plugin

@kjetilhartveit
Copy link

kjetilhartveit commented Dec 18, 2024

App router already supports passing Dates and other non JSON values to client components, you don’t need this plugin

Thanks, good to know! I seem to have issues with the native serializer/deserializer of Next.js though which I didn't experience when using next-superjson-plugin, might have something to do with me using Map for a bunch of stuff. I'm pursuing the issue on Discord at https://discord.com/channels/752553802359505017/1318956577931137114 (and it's supposedly mirrored to https://nextjs-forum.com/post/1318956577931137114).

@Finkes
Copy link

Finkes commented Dec 20, 2024

App router already supports passing Dates and other non JSON values to client components, you don’t need this plugin

Is this true for custom types like Decimal used by prisma? This is the main reason why we need superjson at the moment.

I guess it's only supporting the types listed at https://react.dev/reference/rsc/use-server#serializable-parameters-and-return-values

@LZL0
Copy link

LZL0 commented Dec 20, 2024

App router already supports passing Dates and other non JSON values to client components, you don’t need this plugin

Is this true for custom types like Decimal used by prisma? This is the main reason why we need superjson at the moment.

I guess it's only supporting the types listed at https://react.dev/reference/rsc/use-server#serializable-parameters-and-return-values

Please stop using decimals in postgres & prisma, use Float instead with 24 precision.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants