如何解决asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).


今天运行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增加配置:

 

 核心作用代码如下:

    configureWebpack: config => {
        // 为生产环境修改配置...
        if (process.env.NODE_ENV === 'production') {
            config.mode = 'production';
            // 打包文件大小配置
            config.performance = {
              maxEntrypointSize: 10000000,
              maxAssetSize: 30000000
            }
        }
    },

  


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM