mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-14 10:04:05 +00:00
webpack: hide internal assets and source maps in stats
This commit is contained in:
parent
255a944bc9
commit
29ed894c43
@ -373,8 +373,18 @@ export default class Builder extends Tapable {
|
|||||||
return reject(err)
|
return reject(err)
|
||||||
}
|
}
|
||||||
if (err) return console.error(err) // eslint-disable-line no-console
|
if (err) return console.error(err) // eslint-disable-line no-console
|
||||||
|
|
||||||
|
// Hide internal assets and source maps in stats
|
||||||
|
const hiddenAssets = [
|
||||||
|
/.map$/,
|
||||||
|
/index\..+\.html$/
|
||||||
|
]
|
||||||
|
const statsJson = stats.toJson(this.webpackStats, true)
|
||||||
|
statsJson.assets = statsJson.assets.filter(asset => hiddenAssets.every(e => !e.test(asset.name)))
|
||||||
|
|
||||||
// Show build stats for production
|
// Show build stats for production
|
||||||
console.log(stats.toString(this.webpackStats)) // eslint-disable-line no-console
|
console.log(stats.constructor.jsonToString(statsJson, true))// eslint-disable-line no-console
|
||||||
|
|
||||||
/* istanbul ignore if */
|
/* istanbul ignore if */
|
||||||
if (stats.hasErrors()) {
|
if (stats.hasErrors()) {
|
||||||
return reject(new Error('Webpack build exited with errors'))
|
return reject(new Error('Webpack build exited with errors'))
|
||||||
|
Loading…
Reference in New Issue
Block a user