解決辦法
安裝speed-measure-webpack-plugin查看編譯過程中哪些地方消耗時間久,線程多。
- 安裝
speed-measure-webpack-plugin - 修改
vue.config.js配置插件 - 重新
npm run serve
const SpeedMeasurePlugin = require('speed-measure-webpack-plugin')//查看編譯過程
const smp = new SpeedMeasurePlugin({outputFormat: 'human'})
module.exports = {
...
configureWebpack: smp.wrap({
...
}),
...
};
- 查看編譯過程
eslint-loader和vue-loader-v16占比最大。vue-loader-v16為解決報錯安裝的不能刪,關(guān)閉eslint檢測。vue.config.js中設(shè)置lintOnSave: false - 重新編譯果然快了很多。