Skip to content
This repository was archived by the owner on Feb 18, 2024. It is now read-only.

Commit 51299ce

Browse files
authored
Reduce verbosity of webpack compile output (#1072)
This adjusts the console output to be less verbose, for parity with how it was prior to the switch to native CLIs in #852. In some cases the output has been made to be even more concise than in Neutrino 8, since it's now possible for users to adjust the output via CLI flags, therefore less important to satisfy all use-cases out of the box. For that reason the `debug` handling has also been removed. The output when using webpack-dev-server now includes the duration, which makes it much easier to compare incremental build times. The `performance.hints(false)` of `@neutrinojs/node` has been removed since it's redundant as of webpack 4.2.0: webpack/webpack@c65fb74 Fixes #897.
1 parent f42984f commit 51299ce

File tree

8 files changed

+68
-28
lines changed

8 files changed

+68
-28
lines changed

packages/dev-server/index.js

+3-9
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,11 @@ module.exports = (neutrino, opts = {}) => {
3636
headers: {
3737
host: publicHost
3838
},
39+
// Only display compile duration and errors/warnings, to reduce noise when rebuilding.
3940
stats: {
40-
assets: false,
41-
children: false,
42-
chunks: false,
43-
colors: true,
41+
all: false,
4442
errors: true,
45-
hash: false,
46-
modules: false,
47-
publicPath: false,
48-
timings: false,
49-
version: false,
43+
timings: true,
5044
warnings: true
5145
}
5246
},

packages/karma/index.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,14 @@ module.exports = neutrino => {
5252
[sources]: ['webpack']
5353
},
5454
webpackMiddleware: {
55-
// Using minimal rather than 'errors-only' so that warnings are still shown.
56-
stats: 'minimal'
55+
// Only display webpack compile duration and errors/warnings, since
56+
// the focus should be on the output from the tests/karma instead.
57+
stats: {
58+
all: false,
59+
errors: true,
60+
timings: true,
61+
warnings: true
62+
}
5763
},
5864
webpack: merge(
5965
omit(neutrino.config.toConfig(), ['plugins', 'entry']),

packages/library/index.js

+5-7
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,11 @@ module.exports = (neutrino, opts = {}) => {
9393
.end()
9494
.end()
9595
.end()
96-
.when(neutrino.options.debug, (config) => {
97-
config.merge({
98-
stats: {
99-
maxModules: Infinity,
100-
optimizationBailout: true
101-
}
102-
});
96+
// The default output is too noisy, particularly with multiple entrypoints.
97+
.stats({
98+
children: false,
99+
entrypoints: false,
100+
modules: false
103101
})
104102
.when(neutrino.config.module.rules.has('lint'), () => {
105103
if (options.target === 'node') {

packages/library/test/library_test.js

+10
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ test('valid preset production', t => {
4040
t.deepEqual(config.resolve.extensions, expectedExtensions);
4141
t.is(config.optimization, undefined);
4242
t.is(config.devServer, undefined);
43+
t.deepEqual(config.stats, {
44+
children: false,
45+
entrypoints: false,
46+
modules: false
47+
});
4348

4449
// NODE_ENV/command specific
4550
t.is(config.devtool, 'source-map');
@@ -61,6 +66,11 @@ test('valid preset development', t => {
6166
t.deepEqual(config.resolve.extensions, expectedExtensions);
6267
t.is(config.optimization, undefined);
6368
t.is(config.devServer, undefined);
69+
t.deepEqual(config.stats, {
70+
children: false,
71+
entrypoints: false,
72+
modules: false
73+
});
6474

6575
// NODE_ENV/command specific
6676
t.is(config.devtool, 'source-map');

packages/node/index.js

+5-10
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,6 @@ module.exports = (neutrino, opts = {}) => {
5757

5858
neutrino.config
5959
.when(sourceMap, () => neutrino.use(banner))
60-
.performance
61-
.hints(false)
62-
.end()
6360
.target('node')
6461
.node
6562
.set('__filename', false)
@@ -79,13 +76,11 @@ module.exports = (neutrino, opts = {}) => {
7976
.merge(neutrino.options.extensions.concat('json').map(ext => `.${ext}`))
8077
.end()
8178
.end()
82-
.when(neutrino.options.debug, (config) => {
83-
config.merge({
84-
stats: {
85-
maxModules: Infinity,
86-
optimizationBailout: true
87-
}
88-
});
79+
// The default output is too noisy, particularly with multiple entrypoints.
80+
.stats({
81+
children: false,
82+
entrypoints: false,
83+
modules: false
8984
})
9085
.when(process.env.NODE_ENV === 'development', (config) => {
9186
const mainKeys = Object.keys(neutrino.options.mains);

packages/node/test/node_test.js

+10
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ test('valid preset production', t => {
3939
t.deepEqual(config.resolve.extensions, expectedExtensions);
4040
t.is(config.optimization, undefined);
4141
t.is(config.devServer, undefined);
42+
t.deepEqual(config.stats, {
43+
children: false,
44+
entrypoints: false,
45+
modules: false
46+
});
4247

4348
// NODE_ENV/command specific
4449
t.is(config.devtool, 'source-map');
@@ -58,6 +63,11 @@ test('valid preset development', t => {
5863
t.deepEqual(config.resolve.extensions, expectedExtensions);
5964
t.is(config.optimization, undefined);
6065
t.is(config.devServer, undefined);
66+
t.deepEqual(config.stats, {
67+
children: false,
68+
entrypoints: false,
69+
modules: false
70+
});
6171

6272
// NODE_ENV/command specific
6373
t.is(config.devtool, 'inline-sourcemap');

packages/web/index.js

+6
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,12 @@ module.exports = (neutrino, opts = {}) => {
191191
.end()
192192
.end()
193193
.end()
194+
// The default output is too noisy, particularly with multiple entrypoints.
195+
.stats({
196+
children: false,
197+
entrypoints: false,
198+
modules: false
199+
})
194200
.when(neutrino.config.module.rules.has('lint'), () => {
195201
neutrino.use(loaderMerge('lint', 'eslint'), {
196202
envs: ['browser', 'commonjs']

packages/web/test/web_test.js

+21
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ test('valid preset production', t => {
3333
t.deepEqual(config.resolve.extensions, expectedExtensions);
3434
t.is(config.optimization.runtimeChunk, 'single');
3535
t.is(config.optimization.splitChunks.chunks, 'all');
36+
t.deepEqual(config.stats, {
37+
children: false,
38+
entrypoints: false,
39+
modules: false
40+
});
3641

3742
// NODE_ENV/command specific
3843
t.true(config.optimization.minimize);
@@ -55,6 +60,11 @@ test('valid preset development', t => {
5560
t.deepEqual(config.resolve.extensions, expectedExtensions);
5661
t.is(config.optimization.runtimeChunk, 'single');
5762
t.is(config.optimization.splitChunks.chunks, 'all');
63+
t.deepEqual(config.stats, {
64+
children: false,
65+
entrypoints: false,
66+
modules: false
67+
});
5868

5969
// NODE_ENV/command specific
6070
t.false(config.optimization.minimize);
@@ -65,6 +75,12 @@ test('valid preset development', t => {
6575
t.is(config.devServer.port, 5000);
6676
t.is(config.devServer.public, 'localhost:5000');
6777
t.is(config.devServer.publicPath, '/');
78+
t.deepEqual(config.devServer.stats, {
79+
all: false,
80+
errors: true,
81+
timings: true,
82+
warnings: true
83+
});
6884

6985
const errors = validate(config);
7086
t.is(errors.length, 0);
@@ -81,6 +97,11 @@ test('valid preset test', t => {
8197
t.deepEqual(config.resolve.extensions, expectedExtensions);
8298
t.is(config.optimization.runtimeChunk, 'single');
8399
t.is(config.optimization.splitChunks.chunks, 'all');
100+
t.deepEqual(config.stats, {
101+
children: false,
102+
entrypoints: false,
103+
modules: false
104+
});
84105

85106
// NODE_ENV/command specific
86107
t.false(config.optimization.minimize);

0 commit comments

Comments
 (0)