Does not work with web workers
jdthorpe opened this issue · comments
I've created a minimal reproducible example here with this error. In short, when trying to import a UMD module in a web worker, this error is raised:
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'containerImportMap')
because the following line is run in the web worker:
var containerImportMap = _global.__umfplugin__.containerImportMap
but the __umfplugin__
is only instatntiated in the main thread (dist/main.js
in the compiled package) by the inject Plugin.
PS. Sorry for all the issues. I hope they are helpful (and I wouldn't bother if I didn't think this package was so useful!)
Certainly helpful, thanks a lot
I manually introduced inject-code in worker.js, I have completed the demo, and then I want to automatically inject the code into the worker
I can't judge which files will run on the worker thread, you can manually set the regexp support worker file to use remote,,
Need to update universal-module-federation-plugin@^1.0.5
demo here
Wow! I'm impressed at how quickly you were able to implement this. Thanks so much! Feel free to close this (and my other issues) at your leisure.
I will close the issues after solving the various deficiencies and optimization points you raised