首页 > 其他分享> > 打包警告:asset size limit: The following asset(s) exceed the recommended size limit (244 KiB)
打包警告:asset size limit: The following asset(s) exceed the recommended size limit (244 KiB)
作者:互联网
打包警告:解决办法
1.打包继续压缩
vue.config.js
(当然你得先去安装一下)
//npm i -D compression-webpack-plugin
const CompressionWebpackPlugin = require('compression-webpack-plugin');
config.plugin('compression-webpack-plugin').use(new CompressionWebpackPlugin({
test: /\.(js|css|scss)$/, // 匹配文件名
threshold: 20480, // 对超过20k的数据压缩
minRatio: 0.8,
deleteOriginalAssets: true // 删除源文件
}))
第2个就是关掉警告
.
config["performance"] = {
hints: "warning",
maxEntrypointSize: 10000000,
maxAssetSize: 30000000,
assetFilter: function (assetFilename) {
// 提供资源文件名的断言函数
return assetFilename.endsWith('.css') || assetFilename.endsWith('.js');
}
};
标签:compression,plugin,js,webpack,limit,asset,assetFilename,config,size 来源: https://blog.csdn.net/feishataojin/article/details/122345116