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
Parcel can code split the Worker code into shared bundles and then try to load those bundles with code like below.
importScripts("./dummy2.08cc0e8f.js")
This fails because it's a local url. Parcel has failed to add the domain and root path to the importsScripts url. Manually adding the domain and root path, see below, fixes the problem.
Because the worker is loaded from a different domain it cannot be split into shared bundles.
馃槸 Current Behavior
When the worker tries to load the shared code bundle the browser reports "44b8fa89-d9be-4e3e-8893-33b5506832b9:1 Uncaught DOMException: Failed to execute 'importScripts' on ..."
馃拋 Possible Solution
Some way of telling Parcel not to code split Worker code or certain files. This can be achieved in a crude way by configuring the @parcel/bundler-default minBundles and minBundleSize parameters, but is only good to prove that it is the code splitting of the Worker code that is causing the problem.
馃敠 Context
I have a Custom HTML Element that can use dedicated workers to improve performance. Parcel is splitting the worker code into shared modules which is fine if the hosting HTML page and the custom HTML script are loaded from the same domain, but not if the HTML page is loaded from a different domain.
I'm currently avoiding the problem by not using workers.
I haven't produced a code sample yet, that might be quite difficult, but I'm hoping to get some feedback first. If you accept this as a bug with Parcel then I can probably look into producing an example, if necessary.
馃實 Your Environment
Software
Version(s)
Parcel
2.12.0
Node
18.14.2
npm/Yarn
9.5.0
Operating System
Mac OS 14.3.1
The text was updated successfully, but these errors were encountered:
馃悰 bug report
When a Web Worker needs to be loaded from another domain Parcel dynamically generates a blob Javascript file (eg blob:https://192.168.0.20:3001/86fd3485-c662-4b90-8ea9-b1b439693cef
) containing the following code to load that script.
Parcel can code split the Worker code into shared bundles and then try to load those bundles with code like below.
This fails because it's a local url. Parcel has failed to add the domain and root path to the importsScripts url. Manually adding the domain and root path, see below, fixes the problem.
馃帥 Configuration (.babelrc, package.json, cli command)
package.json
tsconfig.json
馃 Expected Behavior
Because the worker is loaded from a different domain it cannot be split into shared bundles.
馃槸 Current Behavior
When the worker tries to load the shared code bundle the browser reports "44b8fa89-d9be-4e3e-8893-33b5506832b9:1 Uncaught DOMException: Failed to execute 'importScripts' on ..."
馃拋 Possible Solution
Some way of telling Parcel not to code split Worker code or certain files. This can be achieved in a crude way by configuring the @parcel/bundler-default minBundles and minBundleSize parameters, but is only good to prove that it is the code splitting of the Worker code that is causing the problem.
馃敠 Context
I have a Custom HTML Element that can use dedicated workers to improve performance. Parcel is splitting the worker code into shared modules which is fine if the hosting HTML page and the custom HTML script are loaded from the same domain, but not if the HTML page is loaded from a different domain.
I'm currently avoiding the problem by not using workers.
馃捇 Code Sample
I haven't produced a code sample yet, that might be quite difficult, but I'm hoping to get some feedback first. If you accept this as a bug with Parcel then I can probably look into producing an example, if necessary.
馃實 Your Environment
The text was updated successfully, but these errors were encountered: