Skip to content

Error while importing "__wbindgen_placeholder__"."__wbindgen_string_new": unknown import. Expected Function(FunctionType { params: [I32, I32], results: [I32] }) #3559

@coder-xiaotian

Description

@coder-xiaotian

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)

Activity

snOm3ad

snOm3ad commented on Aug 17, 2023

@snOm3ad
Contributor

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

Liamolucko

Liamolucko commented on Aug 18, 2023

@Liamolucko
Contributor

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

coder-xiaotian commented on Aug 18, 2023

@coder-xiaotian
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

daxpedda commented on Aug 20, 2023

@daxpedda
Contributor

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @daxpedda@coder-xiaotian@snOm3ad@Liamolucko

        Issue actions

          Error while importing "__wbindgen_placeholder__"."__wbindgen_string_new": unknown import. Expected Function(FunctionType { params: [I32, I32], results: [I32] }) · Issue #3559 · wasm-bindgen/wasm-bindgen