转自:https://www.cnblogs.com/bbldhf/p/14327133.html

 

今天运行vue项目 npm run build 时,终端webpack报错:

打包报错: 错误原因,资源(asset)和入口起点超过指定文件限制,

asset size limit: The following asset(s) exceed the recommended size limit (244 KiB). This can impact web performance.

 

 解决方法:

在vue.config.js增加配置:

 

 核心作用代码如下:

1
2
3
4
5
6
7
8
9
10
11
configureWebpack: config => {
    // 为生产环境修改配置...
    if (process.env.NODE_ENV === 'production') {
        config.mode = 'production';
        // 打包文件大小配置
        config.performance = {
          maxEntrypointSize: 10000000,
          maxAssetSize: 30000000
        }
    }
},

 

 

posted on 2022-02-22 16:50  紫嫣凝语  阅读(6294)  评论(0)    收藏  举报