I'm using React, Webpack and adopting the Micro-frontend model. I have two simple apps as follows:
- App A (Shell app)
- App B (Remote app).
App B
uses a simple Web Worker as follows:
new Worker(new URL("./myworker.ts", import.meta.url))
App B
runs normally, but when running on App A
, it crashes:
Uncaught SecurityError: Failed to construct 'Worker': Script at 'appB.com/worker.js' cannot be accessed from origin 'appA.com'
I know there is a method that is to use Blob
, but in this case, I don't know how to do that because Worker is on App B
itself.
One more thing, I want App B
to be able to run both standalone and to be able to run well on shell app (App A
).
Is there any solution? Thank