🐛 bug report
Doing async imports in nested workers doesn't work beacuse ./loaders/worker/js-loader isn't available in the inner worker.
😯 Current Behavior
child-worker.b4a550ff.js:59 Uncaught Error: Cannot find module '2TfhN'
at newRequire (child-worker.b4a550ff.js:59)
at newRequire (child-worker.b4a550ff.js:43)
at localRequire (child-worker.b4a550ff.js:81)
at Object.1xm4F../loaders/worker/js-loader (child-worker.b4a550ff.js:144)
at newRequire (child-worker.b4a550ff.js:69)
at localRequire (child-worker.b4a550ff.js:81)
at Object.39YhH../async.js (child-worker.b4a550ff.js:142)
at newRequire (child-worker.b4a550ff.js:69)
at child-worker.b4a550ff.js:118
at child-worker.b4a550ff.js:141
💁 Possible Solution
This is probably because the context is actually the same between main and child worker, so Parcel thinks it can reuse the asset from a parent bundle?
💻 Code Sample
parcel build index.html --no-scope-hoist
<script src="index.js"></script>
// index.js
new Worker("./worker.js");
// worker.js
new Worker("./child-worker.js");
import("./async.js").then((v) => console.log("worker: async=", v));
// child-worker.js
import("./async.js").then((v) => console.log("child worker: async=", v));
// async.js
export const async = "async!";
🌍 Your Environment
🐛 bug report
Doing async imports in nested workers doesn't work beacuse
./loaders/worker/js-loaderisn't available in the inner worker.😯 Current Behavior
💁 Possible Solution
This is probably because the context is actually the same between main and child worker, so Parcel thinks it can reuse the asset from a parent bundle?
💻 Code Sample
parcel build index.html --no-scope-hoist🌍 Your Environment