Confusing warning message when using __wbg_init in @swc/wasm-web v1.7.x
Describe the bug
Starting from @swc/wasm-web v1.7.x, I see this warning message: using deprecated parameters for the initialization function; pass a single object instead when calling __wbg_init without a parameter. Current documentation at https://swc.rs/docs/usage/wasm does not say anything about a required parameter.
When I check code in node_modules\@swc\wasm-web\wasm.d.ts and node_modules\@swc\wasm-web\wasm.js, I see that:
-
__wbg_initallowsmodule_or_pathto be optional. It saysPassing InitInput directly is deprecated. With this way of phrasing, I think it means: "If you want to passInitInput, you need to pass{module_or_path:InitInput}instead of plainInitInput". It does not say anything about skippingmodule_or_path. This is how I interpret it. - Implementation of
__wbg_initshows that ifmodule_or_pathis undefined, it will print the warning message.
Can you confirm that skipping module_or_path is also deprecated? If that's the case, I suggest:
- Clearly state that in the TSDoc.
- Update the documentation at https://swc.rs/docs/usage/wasm.
Input code
No response
Config
No response
Playground link (or link to the minimal reproduction)
https://swc.rs/docs/usage/wasm
SWC Info output
No response
Expected behavior
-
__wbg_initdoes not print the warning message or the TSDoc is updated. - The documentation at https://swc.rs/docs/usage/wasm is up-to-date.
Actual behavior
No response
Version
1.7.11
Additional context
No response
Actually it's generated by wasm-pack and wasm-bindgen, and I don't have any idea about them at the moment.
This issue was fixed in wasm-bindgen. Ref: https://github.com/rustwasm/wasm-bindgen/issues/4122#issuecomment-2380562394
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.