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 while importing "__wbindgen_placeholder__"."__wbindgen_string_new": unknown import. Expected Function(FunctionType { params: [I32, I32], results: [I32] }) #3559

Closed
coder-xiaotian opened this issue Aug 16, 2023 · 4 comments
Labels

Comments

@coder-xiaotian
Copy link

Describe the Bug

I have a swc plugin "use-client", I want to print some info when run this plugin, so I used web_sys::console::log_1 in my code, when I npm link to this repo https://github.com/coder-xiaotian/antd-useclient, thennpm run dev to start, it has the error of below:

Caused by:
    0: failed to invoke `/Users/xiaotian/personal/tech/my-project/use-client/target/wasm32-wasi/release/swc_plugin_use_client.wasm` as js transform plugin at /Users/xiaotian/personal/tech/my-project/use-client/target/wasm32-wasi/release/swc_plugin_use_client.wasm
    1: Error while importing "__wbindgen_placeholder__"."__wbindgen_string_new": unknown import. Expected Function(FunctionType { params: [I32, I32], results: [I32] })
- error Error: Cannot find module '/Users/xiaotian/personal/tech/my-project/antd-useclient/.next/fallback-build-manifest.json'

Additional Context

build command: cargo build-wasi --release
rustc version: rustc 1.70.0 (90c541806 2023-05-31)

@snOm3ad
Copy link
Contributor

snOm3ad commented Aug 17, 2023

This might be related to #3233. You need to file a bug with SWC. See also #3421 (comment)

@Liamolucko
Copy link
Collaborator

It doesn't look like SWC plugins use wasm-bindgen at all, actually, so nothing wasm-bindgen-related is going to work. It looks like tracing is what SWC expects plugins to use for logging, so you should probably use that instead.

@coder-xiaotian
Copy link
Author

It doesn't look like SWC plugins use wasm-bindgen at all, actually, so nothing wasm-bindgen-related is going to work. It looks like tracing is what SWC expects plugins to use for logging, so you should probably use that instead.

Thanks for your reply. It seems like I made a mistake. I will study it again.

@daxpedda
Copy link
Collaborator

wasm-bindgen doesn't support WASI to begin with, so I don't think this is really supposed to work at all.

Feel free to continue discussion here if any more questions come up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants