-
Notifications
You must be signed in to change notification settings - Fork 16
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
Error building project with wasm in web worker #13
Comments
Oh, I forgot about web workers. I'll consider how to implement it when I
have time.
…On Sun, Sep 18, 2022 at 13:32 Graham Daley ***@***.***> wrote:
I'm having a problem when building a Vite 3 / Vue.js 3 project that calls
a wasm from within a web worker.
Everything seems to work fine when I test the app locally, using "yarn
dev". However, when I attempt to build it for production, using "yarn
build", I get the following error:
yarn run v1.22.19
$ vue-tsc --noEmit && vite build
vite v3.1.2 building for production...
✓ 3 modules transformed.
✓ 17 modules transformed.
[vite:worker-import-meta-url] Could not load /Users/gdaley/wasm-test/src/hello_wasm/pkg/hello_wasm_bg.wasm (imported by src/hello_wasm/pkg/hello_wasm.js): Cannot read properties of undefined (reading 'load')
file: /Users/gdaley/wasm-test/src/components/HelloWorld.vue?vue&type=script&setup=true&lang.ts
error during build:
TypeError: Could not load /Users/gdaley/wasm-test/src/hello_wasm/pkg/hello_wasm_bg.wasm (imported by src/hello_wasm/pkg/hello_wasm.js): Cannot read properties of undefined (reading 'load')
at Object.load (/Users/gdaley/wasm-test/node_modules/vite-plugin-wasm/dist/index.js:52:66)
at async file:///Users/gdaley/wasm-test/node_modules/rollup/dist/es/shared/rollup.js:22113:98
at async Queue.work (file:///Users/gdaley/wasm-test/node_modules/rollup/dist/es/shared/rollup.js:22820:32)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I have created a simple project, to illustrate this issue
<https://github.com/grahamdaley/wasm-test>.
Could you please let me know if calling wasm functions from web workers is
supported currently, and if so, what I'm doing wrong?
—
Reply to this email directly, view it on GitHub
<#13>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACWRBAZUXDTV5I7ANZUTWYTV62SOBANCNFSM6AAAAAAQPJJRDI>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
I'd be really grateful if you could. |
@grahamdaley - It took me a while to figure this out but the plugin author doesn't need to change anything you just need to specify the plugin in
|
Thanks @joeally! I'll test it and add it to my E2E tests and docs if it works. |
I run the sample project and found 2 issues:
Seems the worker modules' build process is nothing special than normal scripts. So I think we don't need specfied E2E tests for workers. I'll add the instructions to README. |
Now with |
I'm having a problem when building a Vite 3 / Vue.js 3 project that calls a wasm from within a web worker.
Everything seems to work fine when I test the app locally, using "yarn dev". However, when I attempt to build it for production, using "yarn build", I get the following error:
I have created a simple project, to illustrate this issue.
Could you please let me know if calling wasm functions from web workers is supported currently, and if so, what I'm doing wrong?
The text was updated successfully, but these errors were encountered: