Skip to content

Unable to serve or build app due to runtime ChunkLoadError #22525

@mattlewis92

Description

@mattlewis92

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

Yes, the previous version in which this bug was not present was: 13.0.4

Description

When starting or building our app after upgrading to angular 13 we get a ChunkLoadError in the browser console at runtime because webpack isn't emitting a the .js file for that chunk. There are no build errors in the console, and weirdly after a few incremental rebuilds the problem fixes itself. After some digging I found the root cause was this PR: #22239 If I disable the NamedChunksPlugin in the webpack config, then the problem goes away and everything works as expected.

🔬 Minimal Reproduction

Reproducing this outside of our app is hard. If you're willing to sign an NDA I can just give you access to the repo to debug it yourselves, or if you can give me some instructions on how to debug it my end to find the root cause I'm also happy to do that.

🔥 Exception or Error

ERROR Error: Uncaught (in promise): ChunkLoadError: Loading chunk default-libs_comment_common_src_lib_comments_comment_module_ts-libs_task_comment-bar_src_lib_-ca5e7c failed.
(error: http://localhost:4200/default-libs_comment_common_src_lib_comments_comment_module_ts-libs_task_comment-bar_src_lib_-ca5e7c.js)
ChunkLoadError: Loading chunk default-libs_comment_common_src_lib_comments_comment_module_ts-libs_task_comment-bar_src_lib_-ca5e7c failed.
(error: http://localhost:4200/default-libs_comment_common_src_lib_comments_comment_module_ts-libs_task_comment-bar_src_lib_-ca5e7c.js)

🌍 Your Environment

Angular CLI: 13.1.3
Node: 16.13.1
Package Manager: npm 6.14.15
OS: darwin arm64

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

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1301.2
@angular-devkit/build-angular   13.1.3
@angular-devkit/core            13.1.2
@angular-devkit/schematics      13.1.2
@angular/cdk                    13.1.1
@angular/cli                    13.1.3
@angular/google-maps            12.2.1
@schematics/angular             13.1.3
ng-packagr                      13.1.2
rxjs                            7.4.0
typescript                      4.5.4

Anything else relevant?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions