webpack配置编译进度条
大型项目中编译时间为5-20S,为了更好的显示编译时间,编译时添加一个进度条,通过progress-bar-webpack-plugin插件查看编译进度。
npm i -D progress-bar-webpack-plugin
webpack.common.js配置方式如下
const chalk = require('chalk')
const ProgressBarPlugin = require('progress-bar-webpack-plugin')
module.exports = {
plugins: [
// 进度条
new ProgressBarPlugin({
format: ` :msg [:bar] ${chalk.green.bold(':percent')} (:elapsed s)`
})
],
}