File tree Expand file tree Collapse file tree 4 files changed +20
-3
lines changed
Expand file tree Collapse file tree 4 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,7 @@ webpack v${webpack.version}
8181 }
8282
8383 let config = { } ;
84+ let lastHash ;
8485 let watchConfig ;
8586
8687 if ( ! argv . config && existsSync ( defaultConfigPath ) ) {
@@ -124,6 +125,13 @@ webpack v${webpack.version}
124125 return ;
125126 }
126127
128+ if ( lastHash === stats . hash ) {
129+ log . info ( chalk `{dim ⁿᵃⁿᵒ} Duplicate build detected {dim (${ lastHash } )}\n` ) ;
130+ return ;
131+ }
132+
133+ lastHash = stats . hash ;
134+
127135 const statsDefaults = { colors : chalk . supportsColor . hasBasic , exclude : [ 'node_modules' ] } ;
128136 const { options = { } } =
129137 [ ]
@@ -135,7 +143,8 @@ webpack v${webpack.version}
135143 : options . stats ;
136144 const result = stats . toString ( statsOptions ) ;
137145
138- log . info ( result ) ;
146+ // indent the result slightly to visually set it apart from other output
147+ log . info ( result . split ( '\n' ) . join ( '\n ' ) , '\n' ) ;
139148 } ;
140149
141150 if ( watchConfig ) {
Original file line number Diff line number Diff line change @@ -36,4 +36,12 @@ Generated by [AVA](https://ava.li).
3636 _: [
3737 'undefined',
3838 ],
39- }
39+ }
40+
41+ ## stats
42+
43+ > Snapshot 1
44+
45+ `⬡ webpack: Build Finished␊
46+ ⬡ webpack: 1 module ␊
47+ `
Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ test('multi', async (t) => {
6868
6969test ( 'stats' , async ( t ) => {
7070 const { stderr } = await run ( '--config' , 'stats.config.js' ) ;
71- t . is ( stderr , '⬡ webpack: Build Finished\n⬡ webpack: 1 module' ) ;
71+ t . snapshot ( stderr ) ;
7272} ) ;
7373
7474test ( 'watch' , ( t ) => {
You can’t perform that action at this time.
0 commit comments