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

Confusing warning message when using __wbg_init in @swc/wasm-web v1.7.x #9443

Closed
catloversg opened this issue Aug 16, 2024 · 3 comments
Closed

Comments

@catloversg
Copy link

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_init allows module_or_path to be optional. It says Passing InitInput directly is deprecated. With this way of phrasing, I think it means: "If you want to pass InitInput, you need to pass {module_or_path:InitInput} instead of plain InitInput". It does not say anything about skipping module_or_path. This is how I interpret it.
  • Implementation of __wbg_init shows that if module_or_path is 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:

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

Actual behavior

No response

Version

1.7.11

Additional context

No response

@github-actions github-actions bot locked and limited conversation to collaborators Aug 16, 2024
@kdy1 kdy1 added this to the Planned milestone Aug 17, 2024
@swc-project swc-project unlocked this conversation Aug 17, 2024
@swc-project swc-project deleted a comment from github-actions bot Aug 17, 2024
@kdy1 kdy1 reopened this Aug 17, 2024
@kdy1
Copy link
Member

kdy1 commented Aug 19, 2024

Actually it's generated by wasm-pack and wasm-bindgen, and I don't have any idea about them at the moment.

@catloversg
Copy link
Author

This issue was fixed in wasm-bindgen. Ref: rustwasm/wasm-bindgen#4122 (comment)

@kdy1 kdy1 modified the milestones: Planned, v1.10.0 Dec 2, 2024
@swc-bot
Copy link
Collaborator

swc-bot commented Jan 1, 2025

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.

@swc-project swc-project locked as resolved and limited conversation to collaborators Jan 1, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

3 participants