Skip to content

Angular 13.2.5: ChunkLoadError - Loading chunk file failed #22769

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cloverzero opened this issue Feb 24, 2022 · 7 comments · Fixed by #22800
Closed

Angular 13.2.5: ChunkLoadError - Loading chunk file failed #22769

cloverzero opened this issue Feb 24, 2022 · 7 comments · Fixed by #22800

Comments

@cloverzero
Copy link

cloverzero commented Feb 24, 2022

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

compiler-cli

Is this a regression?

No

Description

Browser console output:

ChunkLoadError: Loading chunk 6528 failed.
(error: http://localhost:8080/6528.483d80564d6ad3bc.js)

Build output:

Lazy Chunk Files                                                                  | Names                              |  Raw Size | Estimated Transfer Size
...
6528.61224ca671bf4352.css, modules-dashboard-dashboard-module.483d80564d6ad3bc.js | modules-dashboard-dashboard-module | 791.85 kB |               169.58 kB
...

But in the runtime.xxxxxxxxxx.js, you can see:

{
  ...
  6528:"483d80564d6ad3bc",
  ...
}

So I think there are some problems with the compiler. modules-dashboard-dashboard-module should be replaced with 6528.

Please provide a link to a minimal reproduction of the bug

https://github.com/cloverzero/temp-ng-minimal

Please provide the exception or error you saw

ERROR Error: Uncaught (in promise): ChunkLoadError: Loading chunk 6528 failed.
(error: http://localhost:8080/6528.483d80564d6ad3bc.js)
ChunkLoadError: Loading chunk 6528 failed.
(error: http://localhost:8080/6528.483d80564d6ad3bc.js)
    at Object.a.f.j (runtime.81647aa4ce430837.js:1:4986)
    at runtime.81647aa4ce430837.js:1:743
    at Array.reduce (<anonymous>)
    at Function.a.e (runtime.81647aa4ce430837.js:1:722)
    at loadChildren (main.201a4656125ced11.js:1:31902)
    at Tr.loadModuleFactory (main.201a4656125ced11.js:1:486382)
    at Tr.load (main.201a4656125ced11.js:1:486027)
    at V.project (main.201a4656125ced11.js:1:478250)
    at V._tryNext (main.201a4656125ced11.js:1:61856)
    at V._next (main.201a4656125ced11.js:1:61774)
    at G (polyfills.9afac977b0dbd767.js:1:15935)
    at G (polyfills.9afac977b0dbd767.js:1:15471)
    at polyfills.9afac977b0dbd767.js:1:16784
    at T.invokeTask (polyfills.9afac977b0dbd767.js:1:7170)
    at Object.onInvokeTask (main.201a4656125ced11.js:1:311724)
    at T.invokeTask (polyfills.9afac977b0dbd767.js:1:7091)
    at I.runTask (polyfills.9afac977b0dbd767.js:1:2565)
    at L (polyfills.9afac977b0dbd767.js:1:9168)
    at m.invokeTask [as invoke] (polyfills.9afac977b0dbd767.js:1:8251)
    at S (polyfills.9afac977b0dbd767.js:1:20169)

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

Angular CLI: 13.2.5
Node: 14.18.1
Package Manager: npm 6.14.15
OS: darwin x64

Angular: 13.2.4
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1302.5
@angular-devkit/build-angular   13.2.5
@angular-devkit/core            13.2.5
@angular-devkit/schematics      13.2.5
@angular/cli                    13.2.5
@schematics/angular             13.2.5
rxjs                            6.6.3
typescript                      4.5.5

Anything else?

No response

@JoostK JoostK transferred this issue from angular/angular Feb 24, 2022
@alan-agius4
Copy link
Collaborator

Does this happen with @angular-devkit/build-angular version 13.2.4?

Can you setup a minimal repro please?

You can read here why this is needed. A good way to make a minimal repro is to create a new app via ng new repro-app and adding the minimum possible code to show the problem. Then you can push this repository to github and link it here.

This might be related to your directory structure so its really important to get an accurate repro to diagnose this.

@alan-agius4 alan-agius4 added the needs: repro steps We cannot reproduce the issue with the information given label Feb 24, 2022
@cloverzero
Copy link
Author

Does this happen with @angular-devkit/build-angular version 13.2.4?

Yes

@alan-agius4
Copy link
Collaborator

In that case we’ll require a reproduction.

@cloverzero
Copy link
Author

@alan-agius4 Here is the reproduction: https://github.com/cloverzero/temp-ng-minimal

@alan-agius4 alan-agius4 added needs: investigation Requires some digging to determine if action is needed and removed needs: repro steps We cannot reproduce the issue with the information given labels Feb 28, 2022
@alan-agius4 alan-agius4 self-assigned this Feb 28, 2022
@alan-agius4
Copy link
Collaborator

Hi @cloverzero, I tied your reproduction locally but I am getting a different sort of error.
Screenshot 2022-03-01 at 12 17 26

@alan-agius4 alan-agius4 added needs: repro steps We cannot reproduce the issue with the information given and removed needs: investigation Requires some digging to determine if action is needed labels Mar 1, 2022
@cloverzero
Copy link
Author

cloverzero commented Mar 3, 2022

@alan-agius4 I have fixed this error. Sorry I didn't realize you were going to run it. I want to mention that it works when ng serve. If you run ng build --configuration production, you'll see the incorrect output. And then, you run with the dist output and see the error I mentioned.

@alan-agius4 alan-agius4 added type: bug/fix freq1: low Only reported by a handful of users who observe it rarely severity5: regression area: @angular-devkit/build-angular devkit/build-angular:browser and removed needs: repro steps We cannot reproduce the issue with the information given labels Mar 4, 2022
@ngbot ngbot bot modified the milestone: Backlog Mar 4, 2022
alan-agius4 added a commit that referenced this issue Mar 4, 2022
alan-agius4 added a commit that referenced this issue Mar 4, 2022
Don't name CSS only chunks.

Closes #22769

(cherry picked from commit e28c715)
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Apr 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants