-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Console warning: "using deprecated parameters for the initialization function; pass a single object instead" #4122
Comments
I am currently building the browser extension template project at https://github.com/Mubelotix/wasm-extension-template. When I deploy this template extension to the latest Chrome browser, I get this warning. I think it's a similar situation. |
@TheMythologist this problem exists in version try this to confirm it in your work environment: [dependencies]
wasm-bindgen = "=0.2.92" # not "0.2.92" nor "0.2" |
Sorry @alpancs, I'm not able to help with the testing of wasm-bindgen 0.2.92. The reason is that my project depends on several other libraries, which rely on wasm-bindgen version 0.2.93.I wish I could be of more assistance. If there's anything else I can do to help or if you have any other requests, please let me know. Details
❯ cargo tree
demo02 v0.1.0 (/home/taiwei.wu/github/webextplaygrand/demo02)
├── chrono v0.4.38
│ ├── iana-time-zone v0.1.61
│ └── num-traits v0.2.19
│ [build-dependencies]
│ └── autocfg v1.3.0
├── console_error_panic_hook v0.1.7
│ ├── cfg-if v1.0.0
│ └── wasm-bindgen v0.2.93
│ ├── cfg-if v1.0.0
│ ├── once_cell v1.19.0
│ └── wasm-bindgen-macro v0.2.93 (proc-macro)
│ ├── quote v1.0.37
│ │ └── proc-macro2 v1.0.86
│ │ └── unicode-ident v1.0.13
│ └── wasm-bindgen-macro-support v0.2.93
│ ├── proc-macro2 v1.0.86 (*)
│ ├── quote v1.0.37 (*)
│ ├── syn v2.0.77
│ │ ├── proc-macro2 v1.0.86 (*)
│ │ ├── quote v1.0.37 (*)
│ │ └── unicode-ident v1.0.13
│ ├── wasm-bindgen-backend v0.2.93
│ │ ├── bumpalo v3.16.0
│ │ ├── log v0.4.22
│ │ ├── once_cell v1.19.0
│ │ ├── proc-macro2 v1.0.86 (*)
│ │ ├── quote v1.0.37 (*)
│ │ ├── syn v2.0.77 (*)
│ │ └── wasm-bindgen-shared v0.2.93
│ └── wasm-bindgen-shared v0.2.93
├── js-sys v0.3.70
│ └── wasm-bindgen v0.2.93 (*)
├── percent-encoding v2.3.1
├── wasm-bindgen v0.2.93 (*)
├── wasm-bindgen-futures v0.4.43
│ ├── cfg-if v1.0.0
│ ├── js-sys v0.3.70 (*)
│ └── wasm-bindgen v0.2.93 (*)
├── web-extensions v0.3.0
│ ├── gloo-utils v0.1.7
│ │ ├── js-sys v0.3.70 (*)
│ │ ├── serde v1.0.210
│ │ │ └── serde_derive v1.0.210 (proc-macro)
│ │ │ ├── proc-macro2 v1.0.86 (*)
│ │ │ ├── quote v1.0.37 (*)
│ │ │ └── syn v2.0.77 (*)
│ │ ├── serde_json v1.0.128
│ │ │ ├── itoa v1.0.11
│ │ │ ├── memchr v2.7.4
│ │ │ ├── ryu v1.0.18
│ │ │ └── serde v1.0.210 (*)
│ │ ├── wasm-bindgen v0.2.93 (*)
│ │ └── web-sys v0.3.70
│ │ ├── js-sys v0.3.70 (*)
│ │ └── wasm-bindgen v0.2.93 (*)
│ ├── js-sys v0.3.70 (*)
│ ├── serde v1.0.210 (*)
│ ├── serde_derive v1.0.210 (proc-macro) (*)
│ ├── serde_json v1.0.128 (*)
│ ├── thiserror v1.0.64
│ │ └── thiserror-impl v1.0.64 (proc-macro)
│ │ ├── proc-macro2 v1.0.86 (*)
│ │ ├── quote v1.0.37 (*)
│ │ └── syn v2.0.77 (*)
│ ├── wasm-bindgen v0.2.93 (*)
│ ├── wasm-bindgen-futures v0.4.43 (*)
│ └── web-extensions-sys v0.4.1
│ ├── js-sys v0.3.70 (*)
│ ├── wasm-bindgen v0.2.93 (*)
│ └── wasm-bindgen-futures v0.4.43 (*)
├── web-extensions-sys v0.4.1 (*)
└── web-sys v0.3.70 (*) |
No changes are necessary. This is a bug in |
I am still getting this warning in v0.2.95, when building with the <script type="module">
import init from "./wasm-rayon-test.js"; // get the default export __wbg_init
init()
</script> This produces the error since the "first" argument to init is |
That's strange, I'm unable to reproduce this. Maybe there is something else involved here? |
You can use this repository to reproduce the problem. You can open it in GitHub codespaces and once it's built, run the build/serve script |
Just looking at If you still want me to try it out locally I'm happy to if you compile the whole thing for me so I just need to serve it without all the tooling around it. |
I am currently encountering this issue: swc-project/swc#9443
Seems like the
default_module_path
is performed too late, only after the object destructuring check:wasm-bindgen/crates/cli-support/src/js/mod.rs
Lines 898 to 906 in 8e66719
Is it possible to shift this default block to the top of the function (or at least before the object destructuring)?
Alternatively, if the intention was to ensure that the default would be provided in the event that
{}
was provided, could you add anelse if (typeof module_or_path !== 'undefined')
before emitting the warning in the console? Or would you recommend swc to change the recommended way toawait initSwc({})
;The text was updated successfully, but these errors were encountered: