Skip to content

Production serve resulting in Error: Unsupported Content-Type "text/html" when loading shared dependencies #110

Description

@leo2823

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:

  1. Run npm i
  2. Run ng serve --configuration=production
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions