asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
vue项目打包的时候报错,如图所示asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).This can impact web performance.原因是因为webpack打包提示文件体积过大导致。解决办法:修改下打包时的配置vue.config.js文件里面修改。没有这个文件就
·
vue项目打包的时候报错,如图所示
asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
原因是因为webpack打包提示文件体积过大导致。
解决办法:
修改下打包时的配置
vue.config.js文件里面修改。没有这个文件就新建一个,跟package.json同级目录
config["performance"] = {
"maxEntrypointSize": 10000000,
"maxAssetSize": 30000000
}
vue.config.js中我的是这样写的,可复制粘贴
module.exports = {
publicPath: "./",
// 输出文件目录
outputDir: process.env.outputDir,
lintOnSave: false,
devServer: { //启动项目在8080端口自动打开
open: true,
port: 8080,
proxy: null,
disableHostCheck: true
},
// 打包体积大报的错
configureWebpack: (config) => {
if (process.env.NODE_ENV === 'production') {// 为生产环境修改配置...
config.mode = 'production';
config["performance"] = {//打包文件大小配置
"maxEntrypointSize": 10000000,
"maxAssetSize": 30000000
}
}
}
}
更多推荐
所有评论(0)