mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
Feat: add possiblity to mute webpack in non-dev modes (#2411)
Move webpackStats to nuxt.options Only clearConsole when we expect webpack to output stats
This commit is contained in:
parent
0f4bf0f9b2
commit
c92d427bb0
@ -39,17 +39,7 @@ module.exports = class Builder {
|
|||||||
this.customFilesWatcher = null
|
this.customFilesWatcher = null
|
||||||
|
|
||||||
// Mute stats on dev
|
// Mute stats on dev
|
||||||
this.webpackStats = this.options.dev ? false : {
|
this.webpackStats = this.options.dev ? false : this.options.build.stats
|
||||||
chunks: false,
|
|
||||||
children: false,
|
|
||||||
modules: false,
|
|
||||||
colors: true,
|
|
||||||
excludeAssets: [
|
|
||||||
/.map$/,
|
|
||||||
/index\..+\.html$/,
|
|
||||||
/vue-ssr-client-manifest.json/
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
// Helper to resolve build paths
|
// Helper to resolve build paths
|
||||||
this.relativeToBuild = (...args) => relativeTo(this.options.buildDir, ...args)
|
this.relativeToBuild = (...args) => relativeTo(this.options.buildDir, ...args)
|
||||||
|
@ -106,8 +106,11 @@ module.exports = function webpackClientConfig() {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const shouldClearConsole = this.options.build.stats !== false &&
|
||||||
|
this.options.build.stats !== 'errors-only'
|
||||||
|
|
||||||
// Add friendly error plugin
|
// Add friendly error plugin
|
||||||
config.plugins.push(new FriendlyErrorsWebpackPlugin())
|
config.plugins.push(new FriendlyErrorsWebpackPlugin({ clearConsole: shouldClearConsole }))
|
||||||
|
|
||||||
// --------------------------------------
|
// --------------------------------------
|
||||||
// Dev specific config
|
// Dev specific config
|
||||||
|
@ -228,7 +228,18 @@ Options.defaults = {
|
|||||||
templates: [],
|
templates: [],
|
||||||
watch: [],
|
watch: [],
|
||||||
devMiddleware: {},
|
devMiddleware: {},
|
||||||
hotMiddleware: {}
|
hotMiddleware: {},
|
||||||
|
stats: {
|
||||||
|
chunks: false,
|
||||||
|
children: false,
|
||||||
|
modules: false,
|
||||||
|
colors: true,
|
||||||
|
excludeAssets: [
|
||||||
|
/.map$/,
|
||||||
|
/index\..+\.html$/,
|
||||||
|
/vue-ssr-client-manifest.json/
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
generate: {
|
generate: {
|
||||||
dir: 'dist',
|
dir: 'dist',
|
||||||
|
Loading…
Reference in New Issue
Block a user