vue打包时报错asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).

错误原因,资源(asset)和入口起点超过指定文件限制,需要在vue.config.js文件内做如下配置:
复制代码
//方法1
module.exports = {
    //webpack配置
    configureWebpack: {
        //关闭webpack的性能提示
        performance: {
          hints:false
        }
        
        //或者
        
        //警告webpack的性能提示
        performance: {
          hints:'warning',
          //入口起点的最大体积
          maxEntrypointSize: 50000000,
          //生成文件的最大体积
          maxAssetSize: 30000000,
          //只给出js文件的性能提示
          assetFilter: function(assetFilename) {
            return assetFilename.endsWith('.js');
          }
        }
    }
}
复制代码
复制代码
//方法2
module.exports = {
    configureWebpack: config => {
        //为生产环境修改配置
        if (process.env.NODE_ENV === 'production') {
            config.mode = 'production';
            //打包文件大小配置
            config.performance = {
              maxEntrypointSize: 10000000,
              maxAssetSize: 30000000
            }
        }
    }
}
复制代码

 参考链接:https://blog.csdn.net/pnjtvxcp/article/details/106075430

posted @   一隅桥畔  阅读(2445)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
历史上的今天:
2021-09-15 Java删除字符串末尾的斜杠/
点击右上角即可分享
微信分享提示