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

feat: allow specifying wasm plugin options #450

Merged
merged 4 commits into from
Aug 31, 2022
Merged

feat: allow specifying wasm plugin options #450

merged 4 commits into from
Aug 31, 2022

Conversation

sisou
Copy link
Contributor

@sisou sisou commented Aug 31, 2022

I'm using nitro in Nuxt 3 and I found that the default options only work when the WASM file is smaller than the default inlining-threshold. Otherwise the Nuxt3 NodeJS server environment (and other server targets I'd imagine) chokes on the wasm plugin using require()calls (how dare them use require in NodeJS! :D). And even if that would be fixed upstream in the @rollup/plugin-wasm package, it's still nice to be able to change the default options here.

src/rollup/config.ts Outdated Show resolved Hide resolved
@pi0 pi0 changed the title Allow specifying wasm plugin options feat: allow specifying wasm plugin options Aug 31, 2022
@sisou
Copy link
Contributor Author

sisou commented Aug 31, 2022

Jaha, I thought so, too. But spreading a boolean is not allowed, sadly.

@pi0
Copy link
Member

pi0 commented Aug 31, 2022

Try this { ...true }. JS is land of wonders :D (only need to fix types)

@sisou
Copy link
Contributor Author

sisou commented Aug 31, 2022

I tried that too before and saw that it works just fine. Only TS is not allowing it. I don't know if you accept // @ts-expect-error in your codebase?

src/rollup/config.ts Outdated Show resolved Hide resolved
@pi0
Copy link
Member

pi0 commented Aug 31, 2022

We can also use as any|[Type]. The main reason is that later it makes it easier to assign some default without ?: branches.

@pi0
Copy link
Member

pi0 commented Aug 31, 2022

Thanks!

@sisou sisou deleted the experimental-wasm-options branch August 31, 2022 12:54
WinterYukky pushed a commit to WinterYukky/nitro that referenced this pull request Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants