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
[plugin:vite:worker-import-meta-url] Vite is unable to parse the worker options as the value is not static. To ignore this error, please use /* @vite-ignore */ in the worker options.
D:/ProGram/IClion/wasm/web/src/assets/wasm.js:1061:65
1059| // the first case in their bundling step. The latter ends up producing an invalid
1060| // URL to import from the server (e.g., for webpack the file:// path).
1061| worker = new Worker(new URL('wasm.js', import.meta.url), workerOptions);
| ^
1062| PThread.unusedWorkers.push(worker);
1063| },
However, the following code does not throw an error:
The Emscripten community has also mentioned this bug but cannot fix it on their end, as it is a Vite issue. As a workaround, I have to manually add the /* @vite-ignore */ comment to the worker options like this:
worker = new Worker(new URL('wasm.js', import.meta.url), /* @vite-ignore */ workerOptions);
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
Describe the bug
Title: Vite fails to parse worker options when they are stored in a variable
Description:
When using Vite with the following code, an error occurs during the bundling process:
The error message is:
However, the following code does not throw an error:
The Emscripten community has also mentioned this bug but cannot fix it on their end, as it is a Vite issue. As a workaround, I have to manually add the /* @vite-ignore */ comment to the worker options like this:
Reproduction
emscripten-core/emscripten#20452
Steps to reproduce
No response
System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: