Description
Description
When code using threads is compiled with Emscripten and then bundled with Vite it does not bundle and throws the following Vite error:
[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.
file
Vite has required static worker options for some time, over 2 years. Recent changes to Emscripten have made output code incompatible with the Vite bundler.
Version of emscripten/emsdk:
Affects versions >= v3.1.58
Reproduction:
I have created a repository at https://github.com/jamsinclair/emscripten-worker-options-vite-reproduction which show cases the problem.
Potential Remedy:
Refactor library_pthread.js to use static values for the worker options. It'll be more verbose, but, it'll make the code compatible with Vite and maintain compatibility with other bundlers.
Metadata
Metadata
Assignees
Labels
No labels