WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).

vue项目打包 报warning: asset size limit: The following asset(s) exceed the recommended size limit (244 KiB). This can impact web performance.

WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB)._第1张图片
这个警告的原因是因为vue的引入的js文件太大

解决方案:可以放开VUE打包大小限制

在vue项目中的vue.config.js的configureWebpack添加如下代码

configureWebpack: {
    // provide the app's title in webpack's name field, so that
    // it can be accessed in index.html to inject the correct title.
    name: name,
    resolve: {
      alias: {
        '@': resolve('src'),
      }
    },
    performance: {
      hints: 'warning',
      maxEntrypointSize: 40000000,
      // 生成文件的最大体积
      maxAssetSize: 20000000,
      assetFilter: function(assetFilename) {
        return assetFilename.endsWith('.js')
      }
    },
  },

最后再重新打包一下就好了

你可能感兴趣的:(vue.js,javascript,前端)