Skip to content

ng build console output shows different chunk sizes than is actually created #3565

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
mdcotter opened this issue Dec 14, 2016 · 9 comments · Fixed by #6989
Closed

ng build console output shows different chunk sizes than is actually created #3565

mdcotter opened this issue Dec 14, 2016 · 9 comments · Fixed by #6989
Assignees
Labels
effort1: easy (hours) P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful severity1: confusing type: bug/fix

Comments

@mdcotter
Copy link

OS?

Mac OSX (El Capitan)

Versions.

angular-cli: 1.0.0-beta.22-1
node: 6.9.2
os: darwin x64

Repro steps.

Updated to the latest angular-cli version
ran ng build --prod --env=stg --aot --no-sourcemap
compared ng output to ls -lh ./dist/

Output logs

ng build output
ls -lh ./dist output

Problem

Noticed that the ng build output displays the size as almost double of what is actually created. i.e it says the the 0.***.chunk.js is 2.06MB, but the file produced s only 938k. More the 2x the actual size.

@hansl
Copy link
Contributor

hansl commented Dec 15, 2016

That's an interesting issue. @TheLarkInn I'm pretty sure this is a webpack issue. What do you think?

@XAMelleOH
Copy link

Same for me here. Size reported in ng build output is 2 or even 3 times bigger than actual sizes.

@FunnyGhost
Copy link

For me it's 4 times higher :)

@filipesilva filipesilva assigned sumitarora and unassigned TheLarkInn May 22, 2017
@filipesilva filipesilva added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent effort1: easy (hours) P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful severity1: confusing and removed P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent labels May 22, 2017
@sumitarora
Copy link
Contributor

@XAMelleOH @FunnyGhost Is it still an issue?

@FunnyGhost
Copy link

FunnyGhost commented Jun 1, 2017

Yeep. The build output says:
chunk {0} polyfills.c9a100b3d87d91c4b1e0.bundle.js (polyfills) 559 kB {4} [initial] [rendered]
chunk {1} main.5cf6336647718faef5a7.bundle.js (main) 483 kB {3} [initial] [rendered]
chunk {2} styles.401ba8300e14d7c38214.bundle.css (styles) 228 bytes {4} [initial] [rendered]
chunk {3} vendor.a054c48ca5a6abfbcf98.bundle.js (vendor) 4.12 MB [initial] [rendered]
chunk {4} inline.2f37a7929a6d875b1ffe.bundle.js (inline) 0 bytes [entry] [rendered]

and the actual sizes are
-a---- 1-6-2017 12:39 1460 inline.2f37a7929a6d875b1ffe.bundle.js
-a---- 1-6-2017 12:39 173244 main.5cf6336647718faef5a7.bundle.js
-a---- 1-6-2017 12:39 175742 polyfills.c9a100b3d87d91c4b1e0.bundle.js
-a---- 1-6-2017 12:39 154308 styles.401ba8300e14d7c38214.bundle.css
-a---- 1-6-2017 12:39 1663240 vendor.a054c48ca5a6abfbcf98.bundle.js

@renevall
Copy link

renevall commented Jun 2, 2017

Still happening as of cli 1.1

@hansl
Copy link
Contributor

hansl commented Jul 14, 2017

There's a misunderstanding with sizes; these sizes are correct, but they're not what you're looking for.

In webpack, there are 2 sizes: assets and chunks. Assets are the actual outputted file sizes. Chunks are pre-seal and their sizes will always be different. Chunk size is basically the size of all the files in the chunk, before optimization, before adding decorations.

My PR just swap those to display the asset size of the first asset of the chunk. This should be more expected for you guys.

@hansl
Copy link
Contributor

hansl commented Jul 14, 2017

BTW, this is why you end up with a 0 bytes inline (which only contains code added by a plugin during the seal step) and CSS that has a size but nothing on disk (because the module itself has JavaScript code around it before ExtractTextPlugin runs and remove it).

@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 Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
effort1: easy (hours) P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful severity1: confusing type: bug/fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants