美文网首页
vue3项目运行慢 npm run serve 卡在40%不动弹

vue3项目运行慢 npm run serve 卡在40%不动弹

作者: 青乌 | 来源:发表于2022-06-24 11:27 被阅读0次

    解决办法

    安装speed-measure-webpack-plugin查看编译过程中哪些地方消耗时间久,线程多。

    1. 安装speed-measure-webpack-plugin
    2. 修改vue.config.js配置插件
    3. 重新npm run serve
    const SpeedMeasurePlugin = require('speed-measure-webpack-plugin')//查看编译过程
    const smp = new SpeedMeasurePlugin({outputFormat: 'human'})
    module.exports = {
        ...
        configureWebpack: smp.wrap({
            ...
        }),
        ...
    };
    
    1. 查看编译过程
      eslint-loader和vue-loader-v16占比最大。vue-loader-v16为解决报错安装的不能删,关闭eslint检测。vue.config.js中设置lintOnSave: false
    2. 重新编译果然快了很多。

    相关文章

      网友评论

          本文标题:vue3项目运行慢 npm run serve 卡在40%不动弹

          本文链接:https://www.haomeiwen.com/subject/brgcvrtx.html