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

Console warning: "using deprecated parameters for the initialization function; pass a single object instead" #4122

Open
TheMythologist opened this issue Sep 20, 2024 · 1 comment
Labels

Comments

@TheMythologist
Copy link

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:

if (typeof module_or_path !== 'undefined') {{
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {{
({{module_or_path{init_memory_arg}{init_stack_size_arg}}} = module_or_path)
}} else {{
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
}}
}}
{default_module_path}

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 an else if (typeof module_or_path !== 'undefined') before emitting the warning in the console? Or would you recommend swc to change the recommended way to await initSwc({});

@TieWay59
Copy link

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.

image

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

2 participants