vite-plugin-wasm
vite-plugin-wasm copied to clipboard
Top level await support
I get the following error: This require call is not allowed because the imported file "vite-plugin-wasm-namespace:/node_modules/.pnpm/@[email protected]/node_modules/@foxglove/wasm-bz2/wasm/module.wasm" contains a top-level await
Is there any way to enable top-level await support for wasm dependencies?
Seems the error is thrown by esbuild?
Second this, having the exact same problem:
The file "node_modules/wasm-brotli/wasm_brotli_browser.js" imports the file
"vite-plugin-wasm-namespace:/<removed>/node_modules/wasm-brotli/wasm_brotli_browser_bg.wasm"
here:
node_modules/wasm-brotli/wasm_brotli_browser.js:1:22:
1 │ import * as wasm from './wasm_brotli_browser_bg.wasm';
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The top-level await in
"vite-plugin-wasm-namespace:/<removed>/node_modules/wasm-brotli/wasm_brotli_browser_bg.wasm"
is here:
vite-plugin-wasm-namespace:/<removed>/node_modules/wasm-brotli/wasm_brotli_browser_bg.wasm:44:27:
44 │ const __vite__wasmModule = await initWasm({ "./wasm_brotli_browser.js": { __wbindgen_string_new: __vite__wasmImport_0_0, __wbindgen_rethrow: __vite__wasmImport_...
╵ ~~~~~
This error is encountered after running vite server, no fail on build
Same. Error when dev, but no error when build. Also using vite-plugin-top-level-await
same issue here