- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Describe the Bug
I am creating a SWC plugin for next js.
I recently started getting an error when running the plugin.
Now this error does not go away. Any recompiled plugin breaks the application. The same plugin compiled a few days ago works.
I reinstalled: cargo, rust, swc_core.
The error text brought me here. What does this error mean? Please help me understand.
In SWC they told me - check if all versions are latest. YES, but that's where their help ended.
Steps to Reproduce
I am completely following the instructions:
https://swc.rs/docs/plugin/ecmascript/getting-started
Run next js and I get an error.
The same plugin that I compiled a few days ago works in the latest version of Next js.
But everything I compile now breaks the application
Expected Behavior
The application must not break
Actual Behavior
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("C:\\Users\\79833\\WebstormProjects\\TestSWC\\nextnew\\node_modules\\next
\\dist\\client\\dev\\amp-dev.js")'
Caused by:
Error while importing "__wbindgen_placeholder__"."__wbindgen_describe": unknown import. Expected Function(FunctionType { params: [I32], results: [] })', C:\Use
rs\runneradmin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\swc-0.260.41\src\plugin.rs:219:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("C:\\Users\\79833\\WebstormProjects\\TestSWC\\nextnew\\node_modules\\next
\\dist\\client\\next-dev.js")'
Caused by:
Error while importing "__wbindgen_placeholder__"."__wbindgen_describe": unknown import. Expected Function(FunctionType { params: [I32], results: [] })', C:\Use
rs\runneradmin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\swc-0.260.41\src\plugin.rs:219:14
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("C:\\Users\\79833\\WebstormProjects\\TestSWC\\nextnew\\node_modules\\next
\\dist\\client\\router.js")'
Caused by:
Error while importing "__wbindgen_placeholder__"."__wbindgen_describe": unknown import. Expected Function(FunctionType { params: [I32], results: [] })', C:\Use
rs\runneradmin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\swc-0.260.41\src\plugin.rs:219:14
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("C:\\Users\\79833\\WebstormProjects\\TestSWC\\nextnew\\node_modules\\next
\\dist\\client\\app-next-dev.js")'
Caused by:
Error while importing "__wbindgen_placeholder__"."__wbindgen_describe": unknown import. Expected Function(FunctionType { params: [I32], results: [] })', C:\Use
rs\runneradmin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\swc-0.260.41\src\plugin.rs:219:14
thread '<unnamed>' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some("C:\\Users\\79833\\WebstormProjects\\TestSWC\\nextnew\\node_modules\\next
\\dist\\pages\\_app.js")'
Additional Context
I don't add anything other than the SWC starter kit. This is definitely not my fault.
I reinstalled everything except windows. I am ready to test any theory to solve the problem, and provide any information. Answer, please. I need any advice
Activity
snOm3ad commentedon May 8, 2023
Could you try setting
RUST_LOG=trace
and see if there's anything else in the logs?romanusname commentedon May 9, 2023
This error is printed to the console many times
daxpedda commentedon May 9, 2023
I'm not sure this is the place to ask this, probably better to figure it out in SWC, if it is a bug in
wasm-bindgen
a more minimal example, that doesn't involve tools outsidewasm-bindgen
, would be really helpful.romanusname commentedon May 9, 2023
I asked this question to the SWC developers. Unfortunately they don't answer.
Why is this problem possible? I found a discussion thread with the same problem. In that case, another version of rust nightly helped. swc-project/swc#6883
I have tried this version and many others. And I will try all versions of rust. I have no other ideas :(
daxpedda commentedon May 12, 2023
Looking at swc-project/swc#6883, the problem seems more clear now. The latest release seems to have broken WASI support, which is not actually officially supported by
wasm-bindgen
.I encourage you to bring your use-case and point of view to #3421.