You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
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 usesimport * 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 usingimport default
.I found I can use
wasm-pack build --target web
to avoid theimport * as wasm from './xx.wasm'
, but when I went to production, it failed byimport.meta.url
, maybe use some plugin can handle theimport.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
The text was updated successfully, but these errors were encountered: