Open wndffs opened 1 month ago
webpack config diffs:
without MF (working config):
optimization.runtimeChunk='single'
experiments.outputModule=undefined
output.publicPath=''
plugins.pluginOptions.jitMode=true
MF (web worker error):
optimization.runtimeChunk=false
experiments.outputModule=true
output.publicPath='auto'
resolve.alias={ some shared libs, ... }
plugins.pluginOptions.jitMode=false
plugins.[15]._options={ "name": "dashboard", "filename": "remoteEntry.mjs",
"shared": {
"@ng-mf/data-access-user": {
"requiredVersion": false
},
"@angular/core": {
"singleton": true,
"strictVersion": true,
"requiredVersion": "18.0.4"
}, } ... }
Looks like it's related to https://github.com/webpack/webpack/issues/16173
Current Behavior
I am running a project with NX, dynamic Module Federation, and a Web Worker. I expect that there should be no issues and that the Web Worker will function as it did previously without Module Federation. However, if there are no imports in the Web Worker, everything works as expected.
Error:
error in this function:
Forked repository from NX Dynamic Module Federation Guide. Added Web Worker with generator
nx g @nx/angular:web-worker myWebWorker --project=dashboard
provide Web Worker in app.component serve appExpected Behavior
Script in Web Worker works as expected without error.
GitHub Repo
https://github.com/wndffs/nx-ng-dyn-fed-web-worker-bug
Steps to Reproduce
Nx Report
Failure Logs
No response
Package Manager Version
No response
Operating System
Additional Information
If there are no imports in the Web Worker, everything works as expected.
In my example you can use setInterval() and worker works fine.
but with any import, be it a class/interface/method - the Web Worker stops working