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

Top level await support #52

Open
ESchouten opened this issue Jan 26, 2024 · 3 comments
Open

Top level await support #52

ESchouten opened this issue Jan 26, 2024 · 3 comments

Comments

@ESchouten
Copy link

I get the following error:
This require call is not allowed because the imported file "vite-plugin-wasm-namespace:/node_modules/.pnpm/@foxglove+wasm-bz2@0.1.1/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?

@Menci
Copy link
Owner

Menci commented Jan 26, 2024

Seems the error is thrown by esbuild?

@nick-benyo
Copy link

nick-benyo commented Feb 10, 2024

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

@inyellowbus
Copy link

Same. Error when dev, but no error when build. Also using vite-plugin-top-level-await

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

No branches or pull requests

4 participants