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

Can be configured to close the wasm pre-compile #3299

Closed
ahabhgk opened this issue May 7, 2021 · 1 comment
Closed

Can be configured to close the wasm pre-compile #3299

ahabhgk opened this issue May 7, 2021 · 1 comment

Comments

@ahabhgk
Copy link
Contributor

ahabhgk commented May 7, 2021

Clear and concise description of the problem

I'm using wasm-pack to build wasm from rust, it's compilation is a npm package which has a wasm file and a js wrapper for the wasm file. The js wrapper uses import * as wasm from './xx.wasm', so when use with vite, vite's wasm pre-compile cause the import failed, because the js wrapper is not using import default.

I found I can use wasm-pack build --target web to avoid the import * as wasm from './xx.wasm', but when I went to production, it failed by import.meta.url, maybe use some plugin can handle the import.meta.url, but I don't think it's a good solution.

Suggested solution

Can be configured to close the wasm pre-compile, because the wasm-pack(or some other wasm builders) has already handled properly the .wasm file for developer, so vite doesn't need to pre-compile the .wasm file.

Alternative

Additional context

@ahabhgk
Copy link
Contributor Author

ahabhgk commented May 8, 2021

I found that plugin API configResolved can modify the internal configuration of vite.

@ahabhgk ahabhgk closed this as completed May 8, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant