Create a separate webpack.conf for testing
You can set all shared modules to eager: true
in your primary webpack.config.js
, but that would force you to use a larger bundle size, one of the things Module Federation aims to avoid.
A better option could be to set up a separate webpack.test.config.js,
which will just be used for running tests, and in that file set your modules to eager: true
:
webpack.test.config.js
shared: share({
"@angular/core": {
eager: true,
singleton: true,
strictVersion: true,
requiredVersion: 'auto'
},
"@angular/common": {
eager: true,
singleton: true,
strictVersion: true,
requiredVersion: 'auto'
},
"@angular/common/http": {
eager: true,
singleton: true,
strictVersion: true,
requiredVersion: 'auto'
}
})