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

浙公网安备 33010602011771号