webpack打包提示文件体积过大导致:
The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
修改下打包时的配置
config["performance"] = {"maxEntrypointSize": 10000000,"maxAssetSize": 30000000
}
具体:vue.config.js中
module.exports = {publicPath: './', // 基本路径outputDir: 'dist', // 输出文件目录assetsDir: "static", //放置生成的静态文件目录(js css img)productionSourceMap: false, // 生产环境是否生成 sourceMap 文件chainWebpack: config => {config.resolve.alias.set('@', resolve('src')).set('assets', resolve('src/assets')).set('components', resolve('src/components'))},configureWebpack: (config) => {if (process.env.NODE_ENV === 'production') {// 为生产环境修改配置...config.mode = 'production';config["performance"] = {//打包文件大小配置"maxEntrypointSize": 10000000,"maxAssetSize": 30000000}}}
}