当前位置: 代码迷 >> 综合 >> npm run build: WARNING in asset size limit: The following asset(s) exceed the recommended size limit
  详细解决方案

npm run build: WARNING in asset size limit: The following asset(s) exceed the recommended size limit

热度:89   发布时间:2023-11-26 03:10:23.0

webpack升级webpack4后打包出现文件大小警告提示

npm run build: WARNING in asset size limit: The following asset(s) exceed the recommended size limit

网上查找方法多数为修改webpack.config.js  

实际项目中无此文件,是多个文件组合起来的  只需要修改webpack.base.config.js文件中配置

module.exports = {performance: {hints: 'warning',//入口起点的最大体积 整数类型(以字节为单位)maxEntrypointSize: 50000000,//生成文件的最大体积 整数类型(以字节为单位 300k)maxAssetSize: 30000000,//只给出 js 文件的性能提示assetFilter: function(assetFilename) {return assetFilename.endsWith('.css') || assetFilename.endsWith('.js');}},mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',context: path.resolve(__dirname, '../'),entry: {app:  ["babel-polyfill", "./src/main.js"]},
........
}

 

  相关解决方案