entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit

发布时间:2023-06-11 19:00

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 }

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
      }
    }
  }
}

ItVuer - 免责声明 - 关于我们 - 联系我们

本网站信息来源于互联网,如有侵权请联系:561261067@qq.com

桂ICP备16001015号