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

[node-rs/jieba, lunr.zh error] top-level await is not available in the configured target environment #118

Open
mail2gouri opened this issue Jan 28, 2025 · 0 comments

Comments

@mail2gouri
Copy link

I am getting following error while building my project:

✘ [ERROR] Top-level await is not available in the configured target environment ("chrome87", "edge88", "es2020", "firefox78", "safari14" + 2 overrides)

node_modules/@node-rs/jieba-wasm32-wasi/jieba.wasi-browser.js:22:19:
  22 │ const __wasmFile = await fetch(__wasmUrl).then((res) => res.arrayBuffer())
     ╵                    ~~~~~

✘ [ERROR] This require call is not allowed because the transitive dependency "node_modules/@node-rs/jieba-wasm32-wasi/jieba.wasi-browser.js" contains a top-level await

node_modules/lunr-languages/lunr.zh.js:33:37:
  33 │     module.exports = factory(require('@node-rs/jieba'))
     ╵                                      ~~~~~~~~~~~~~~~~

The file "node_modules/@node-rs/jieba/browser.js" imports the file
"node_modules/@node-rs/jieba-wasm32-wasi/jieba.wasi-browser.js" here:

node_modules/@node-rs/jieba/browser.js:1:14:
  1 │ export * from '@node-rs/jieba-wasm32-wasi'
    ╵               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The top-level await in "node_modules/@node-rs/jieba-wasm32-wasi/jieba.wasi-browser.js" is here:

node_modules/@node-rs/jieba-wasm32-wasi/jieba.wasi-browser.js:22:19:
  22 │ const __wasmFile = await fetch(__wasmUrl).then((res) => res.arrayBuffer())

Following is the environment
vue 3.4.4
vite 4.5.3
node 18.16

Appreciate your help with this issue. Thanks!

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

1 participant