Skip to content

function "statsToString" only prints the size of the first file #16627

Closed
@EmaGht

Description

@EmaGht

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • xi18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

No

Description

I'm CLI-izing an old application and to do so, i've set up the build target with
@angular-builders/custom-webpack:browser
My webpack.config.js emits the main_client.js together with an initial.css,
when this happens, the Angular-CLI function statsToString only prints the size of the first file it encounters like so:

function statsToString(json, statsConfig) {
    const colors = statsConfig.colors;
    const rs = (x) => colors ? reset(x) : x;
    const w = (x) => colors ? bold(white(x)) : x;
    const changedChunksStats = json.chunks
        .filter((chunk) => chunk.rendered)
        .map((chunk) => {
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//Notice "chunk.files[0]"
        const asset = json.assets.filter((x) => x.name == chunk.files[0])[0];
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
        return generateBundleStats({ ...chunk, size: asset && asset.size }, colors);
    });

which generates this not-so-good report where the sizes are 73KB for initial.css and around 8MB for main-client.js

.
.
.
chunk {main-client} initial.css, main-client.js (main-client) 73 kB [entry] [rendered]

Now, i know i'm not supposed to use my own webpack with the CLI etc.. etc.. etc.. but since the logger actually prints all initial file's names i would assume it would also sum their sizes?

Still, the build is somehow working and I'm already quite happy about that, but if you guys could fix up the size count of the initial chunk, that would be terrific! :)

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions