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
fix(@angular/cli); show only changed chunks on build #8875
Conversation
f159b3b
to
a2c726d
Compare
}).join('\n')} | ||
}).join('\n'); | ||
|
||
const unchangedChunkNumber = json.chunks.filter((chunk: any) => !chunk.rendered).length; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't this work too ? no need to loop through chunks again.
const unchangedChunkNumber = json.chunks.length - changedChunksStats.length;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nvm didn't see the join
. Could still keep the resulting array and join later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good idea, I'll do that.
Date: ${w(new Date().toISOString())} | ||
Hash: ${w(json.hash)} | ||
Time: ${w('' + json.time)}ms | ||
${changedChunksStats ? changedChunksStats + '\n' : ''}${unchangedChunksMessage} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks to this pullrequest. @filipesilva What you think to reorder console & get little bit more concis (because in dev mode, imo, short is better)
Before:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this looks really good :) It's no longer than this line either:
** NG Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the shorter as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the first message to show the shorter output in the after snippet.
For projects with a lot of lazy modules the rebuild messages can easily fill the whole console window. This PR shows only chunks that changed instead of showing all chunks. Before: ``` $ ng serve ** NG Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ ** Date: 2017-12-14T14:56:13.707Z Hash: 7490b2942c48ffcf0f0f Time: 7317ms chunk {inline} inline.bundle.js (inline) 5.79 kB [entry] [rendered] chunk {main} main.bundle.js (main) 725 kB [initial] [rendered] chunk {polyfills} polyfills.bundle.js (polyfills) 577 kB [initial] [rendered] chunk {styles} styles.bundle.js (styles) 35 kB [initial] [rendered] chunk {vendor} vendor.bundle.js (vendor) 6.45 MB [initial] [rendered] webpack: Compiled successfully. webpack: Compiling... Date: 2017-12-14T14:56:17.054Z Hash: dbb03cc0994e8bf69e76 Time: 310ms chunk {inline} inline.bundle.js (inline) 5.79 kB [entry] chunk {main} main.bundle.js (main) 725 kB [initial] [rendered] chunk {polyfills} polyfills.bundle.js (polyfills) 577 kB [initial] chunk {styles} styles.bundle.js (styles) 35 kB [initial] chunk {vendor} vendor.bundle.js (vendor) 6.45 MB [initial] webpack: Compiled successfully. webpack: Compiling... Date: 2017-12-14T14:56:20.290Z Hash: fe53cbcd529dd2508cfc Time: 267ms chunk {inline} inline.bundle.js (inline) 5.79 kB [entry] chunk {main} main.bundle.js (main) 725 kB [initial] chunk {polyfills} polyfills.bundle.js (polyfills) 577 kB [initial] [rendered] chunk {styles} styles.bundle.js (styles) 35 kB [initial] chunk {vendor} vendor.bundle.js (vendor) 6.45 MB [initial] webpack: Compiled successfully. ``` After: ``` $ ng serve ** NG Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ ** Date: 2017-12-14T14:53:40.216Z Hash: 44065f5ec5c4c8cf884a Time: 7312ms chunk {inline} inline.bundle.js (inline) 5.79 kB [entry] [rendered] chunk {main} main.bundle.js (main) 724 kB [initial] [rendered] chunk {polyfills} polyfills.bundle.js (polyfills) 576 kB [initial] [rendered] chunk {styles} styles.bundle.js (styles) 35 kB [initial] [rendered] chunk {vendor} vendor.bundle.js (vendor) 6.45 MB [initial] [rendered] webpack: Compiled successfully. webpack: Compiling... Date: 2017-12-14T14:53:42.089Z Hash: 492a7350b12ec1557b61 Time: 241ms chunk {main} main.bundle.js (main) 725 kB [initial] [rendered] 4 unchanged chunks webpack: Compiled successfully. webpack: Compiling... Date: 2017-12-14T14:53:49.762Z Hash: 7490b2942c48ffcf0f0f Time: 296ms chunk {polyfills} polyfills.bundle.js (polyfills) 577 kB [initial] [rendered] 4 unchanged chunks webpack: Compiled successfully. ``` Fix angular#8621
a2c726d
to
2e33cc5
Compare
|
||
if (unchangedChunkNumber > 0) { | ||
return rs(stripIndents` | ||
Date: ${w(new Date().toISOString())} • Hash: ${w(json.hash)} • Time: ${w('' + json.time)}ms |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This output leads to two beep sounds on windows systems due to the two '•' characters, see https://blogs.msdn.microsoft.com/oldnewthing/20070104-00/?p=28513
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use a fancy character they said. What could go wrong they said.
😞
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TobiasSchulte does this happen on your system? I tried on mine (Windows 10, basic cmd
) and I didn't get a beep.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@filipesilva Yes, it happens on my machine and on the machine of a colleague. Both are Windows 7 systems, it happens in a normal cmd, but not for example in the vscode integrated terminal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you be interested in making a PR that changes •
to -
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@filipesilva Pull request is created
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TobiasSchulte we have already made that change in #9336
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
For projects with a lot of lazy modules the rebuild messages can easily fill the whole console window.
This PR shows only chunks that changed instead of showing all chunks.
Before:
After:
Fix #8621