-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Regression: mainScriptUrlOrBlob ignored when USE_ES6_IMPORT_META is off #23769
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
Comments
For a bit more detail: Using a blob as the actual script means that import.meta.url is a blob, so new URL(...) can't work. Using a mainScriptBlobOrUrl is just ignored. So both of the tricks I've used in the past for cross origin workers are not available. |
Thanks Joe! We are obviously lacking some test coverage here. |
I think a reasonable fix for this is to:
|
Per the discussion in emscripten-core#23769, implement this policy: - If mainScriptUrlOrBlob is set, create the worker as in the old non-use-import-meta case - If import.meta.url is a blob url, use it for the worker script - Otherwise, use new URL(TARGET_JS_NAME, import.meta.url)
Per the discussion in emscripten-core#23769, implement this policy: - If mainScriptUrlOrBlob is set, create the worker as in the old non-use-import-meta case - Otherwise, use import.meta.url
Per the discussion in emscripten-core#23769, implement this policy: - If mainScriptUrlOrBlob is set, create the worker as in the old non-use-import-meta case - Otherwise, use import.meta.url
Spun out from #23804 . This is a fix for #23769 which was introduced by #23171 , where the use of the bundler pattern hard-coding a script name was made to apply to all ES6 exports. `mainScriptUrlOrBlob` is necessary under es6 exports to support running a threaded emscripten module from another origin, e.g. to distribute an emscripten module on a CDN (the script will load for the main thread but won’t be allowed to create workers). Using blobs is an effective workaround.
I believe this was fixed in #23890 and can be closed? |
Fixed in #23890 |
Per #23171 (comment)
The recent removal of USE_ES6_IMPORT_META broke a use case like this:
This used to be supported using either an importScripts() hack in the worker or by downloading the whole script as a blob, but now that's not possible since the fix in #23171 forces the use of a specific file name.
The text was updated successfully, but these errors were encountered: