Skip to content

Module Federation crashes with production configuration in Angular 21 #20332

Description

@leo2823

Bug 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:

  1. Run npm i
  2. 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

help wantedMaintainers welcome a community PR for this

Type

Fields

Priority

None yet

Effort

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions