今天运行vue项目 npm run build 时,终端webpack报错:

打包报错: 错误原因,资源(asset)和入口起点超过指定文件限制,

asset size limit: The following asset(s) exceed the recommended size limit (244 KiB). This can impact web performance.

如何解决asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).

 

 解决方法:

在vue.config.js增加配置:

如何解决asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).

 

 核心作用代码如下:

    configureWebpack: config => {
        // 为生产环境修改配置...
        if (process.env.NODE_ENV === 'production') {
            config.mode = 'production';
            // 打包文件大小配置
            config.performance = {
              maxEntrypointSize: 10000000,
              maxAssetSize: 30000000
            }
        }
    },

  

相关文章:

  • 2022-12-23
  • 2021-12-11
  • 2021-11-10
  • 2021-10-23
  • 2021-08-21
  • 2022-01-02
  • 2021-11-18
猜你喜欢
  • 2021-09-16
  • 2021-08-30
  • 2021-06-03
  • 2022-12-23
  • 2022-01-08
相关资源
相似解决方案