Skip to content

Angular generates chunks with no content on production build causes deployment issues related to MIME type #30376

Closed as not planned
@tibin-carestack

Description

@tibin-carestack

Which @angular/* package(s) are the source of the bug?

Don't known / other

Is this a regression?

Yes

Description

Angular 19 production builds (ng build --configuration production) are sometimes generating empty (0-byte) or malformed JavaScript chunk files (chunk-XXXXX.js). When deployed, browsers attempt to load these, resulting in "Failed to load module script: The server responded with a non-JavaScript MIME type" errors because the server serves an incorrect MIME type (e.g., text/html). This prevents the application from loading and causes significant deployment issues.

Impact: Application failure to load in production, broken user experience, difficult debugging due to misleading MIME type errors.

Expected Behavior: All production build chunks should contain valid JavaScript content and be served with text/javascript MIME type.

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw


Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 19.2.13
Node: 20.18.0
Package Manager: npm 11.1.0
OS: win32 x64

Angular: 19.2.12
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router, service-worker

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1402.13
@angular-devkit/build-angular   19.2.13
@angular-devkit/core            19.2.13
@angular-devkit/schematics      19.2.13
@angular/cdk                    19.2.8
@angular/cli                    19.2.13
@schematics/angular             19.2.13
rxjs                            7.8.2
typescript                      5.8.2
zone.js                         0.15.0

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs: repro stepsWe cannot reproduce the issue with the information given

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions