Skip to content

Update bundle meta when using NG_BUILD_OPTIMIZE_CHUNKS #28830

Open
@ChristopherPHolder

Description

@ChristopherPHolder

Command

build

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

When we run a build with NG_BUILD_OPTIMIZE_CHUNKS the stats.json file is not updated so it will show build with the old bundles and not the new ones.

This makes it harder to analyse the build output.

Minimal Reproduction

Run ng build --statsJson on any project using the NG_BUILD_OPTIMIZE_CHUNKS environment variable.

Then open the stats.json on https://esbuild.github.io/analyze/

You should clearly notice that the old chunks before the optimization are present and the changes on main are not reflected.

Image

Image

Exception or Error


Your Environment

Angular CLI: 18.2.6
Node: 22.10.0
Package Manager: npm 10.9.0
OS: win32 x64

Angular: 18.2.6
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... platform-server, router, ssr

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1802.6
@angular-devkit/build-angular   18.2.6
@angular-devkit/core            18.2.6
@angular-devkit/schematics      18.2.6
@schematics/angular             18.2.6
rxjs                            7.8.1
typescript                      5.5.4
zone.js                         0.14.10

Anything else relevant?

Potential solution is to adapt the meta data eg:

https://github.com/push-based/ngx-build/blob/ec331e177e43f2c45d4f56b4df4d87a20a5fabfd/packages/esbuild-plugin/src/lib/bundle-adaptor.utils.ts

I am happy to contribute and help if can :)

Related:

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions