GeezerVison is showing github.com — Module Federation crashes with production configuration in Angular 21 · Issue #20332 · webpack/webpack
Module Federation crashes with production configuration in Angular 21 #20332DescriptionBug Description
Module federation crashes with a run-time error starting from @angular-devkit/[email protected] (which requires [email protected]). The error message is one of the following, according to the strategy of dependencies' sharing adopted (shareAll or share, you can find more into the webpack configuration of the reproduction example):
- TypeError: Class extends value undefined is not a constructor or null
- TypeError: (0 , c.bootstrapApplication) is not a function
[email protected] introduced some changes into the concatenateModules optimization option that seem to cause this error. I tested the webpack configuration disabling this option and no error was thrown.
Link to Minimal Reproduction and step to reproduce
https://github.com/leo2823/ng-mfe-issue
Steps:
- Run
npm i
- Run
ng serve --configuration=production
Expected Behavior
No run-time error thrown among the listed ones.
Actual Behavior
TypeError: (0 , c.bootstrapApplication) is not a function
at 6801 (801.js:1:1166)
at webpack_require (main.js:23:2346)
TypeError: Class extends value undefined is not a constructor or null
at 4360 (37.js:1:22082)
at webpack_require (main.js:23:2346)
at 9898 (37.js:1:51831)
at webpack_require (main.js:23:2346)
Environment
System:
OS: Windows 11
Binaries:
Node: 24.12.0
npm: 11.6.2
Packages:
webpack: 5.104.1
Is this a regression?
Yes (please specify version below)
Last Working Version
5.103
Additional Context
This commit seems to introduce the unexpected run-time errors. Reacted by Alex Burck and Egor Volvachev ActivityPrathmesh761 commented on Jan 19, 2026 Prathmesh761 commented on Jan 19, 2026 leo2823 commented on Jan 20, 2026 Author show commentMore actions Prathmesh761 commented on Jan 20, 2026 leo2823 commented on Jan 21, 2026 Author show commentMore actions burck1 commented on Jan 23, 2026 Hi! We are able to consistently re-create the same error now with v20.3.15 of the @angular/cli and @angular-devkit/build-angular packages (released yesterday). It looks like this is because v20.3.15 of those packages depends on [email protected], whereas v20.3.14 depends on [email protected].
As a workaround, we were able to downgrade to v20.3.14 (>=20.0.0 <20.3.15).
Additionally, we tested the workaround provided by @leo2823, which also resolves the problem after we upgrade to v20.3.15 of the packages.
Example webpack.config.js:
const { share, withModuleFederationPlugin } = require('@angular-architects/module-federation/webpack');
const { merge } = require('webpack-merge');
module.exports = merge(
withModuleFederationPlugin({
name: 'my-app',
shared: share({ /* ... */ }),
}),
{
optimization: {
concatenateModules: false,
},
},
);
Looking forward to testing after #20346 is released and the angluar packages are updated to use the new version. hai-x commented on Jan 23, 2026
Looking forward to testing after #20346 is released and the angluar packages are updated to use the new version.
@leo2823 Hi, you can just override webpack version to webpack@https://pkg.pr.new/webpack@17eb426 to test it. Thank you. leo2823 commented on Jan 23, 2026 Hi @hai-x, thanks for your PR! I test it and I can confirm it fixes the error. burck1 commented on Jan 27, 2026 Thanks @hai-x and @leo2823! I tested the update with webpack@https://pkg.pr.new/webpack@3a73621 (latest on main after the merge) and it looks like that resolves the issue. Thanks!
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|