Description
When using the Angular 21 compatible version of Native Federation v4, running a production serve for a basic Angular application results in the following runtime error:
Error: Unsupported Content-Type "text/html" loading http://localhost:4200/@id/@angular/core imported from http://localhost:4200/chunk-X67XPUWB.js. Modules must be served with a valid MIME type like application/javascript.
The application imports secondary entry points from shared dependencies in app.config.ts.
The issue does not occur when serving the generated dist output with a static web server. It only occurs when using ng serve --configuration=production.
While investigating, I also reproduced the same behavior on the Angular 22 branch. Specifically, the tractor-store example exhibits the same error after downgrading @angular/build and the related Angular packages to version 22.0.5. However, the issue is no longer reproducible with the latest Angular 22 releases.
Minimal reproduction
Repo
Steps:
- Run
npm i
- Run
ng serve --configuration=production
- Open the application in the browser
Expected behavior
The application should start successfully when served with ng serve --configuration=production, just as it does when serving the built dist output with a static server.
Description
When using the Angular 21 compatible version of Native Federation v4, running a production serve for a basic Angular application results in the following runtime error:
Error: Unsupported Content-Type "text/html" loading http://localhost:4200/@id/@angular/core imported from http://localhost:4200/chunk-X67XPUWB.js. Modules must be served with a valid MIME type like application/javascript.The application imports secondary entry points from shared dependencies in app.config.ts.
The issue does not occur when serving the generated dist output with a static web server. It only occurs when using
ng serve --configuration=production.While investigating, I also reproduced the same behavior on the Angular 22 branch. Specifically, the tractor-store example exhibits the same error after downgrading @angular/build and the related Angular packages to version 22.0.5. However, the issue is no longer reproducible with the latest Angular 22 releases.
Minimal reproduction
Repo
Steps:
npm ing serve --configuration=productionExpected behavior
The application should start successfully when served with
ng serve --configuration=production, just as it does when serving the built dist output with a static server.