vue.config配置gzip出现Multiple assets emit different content to the same filename static/js/.gz

在vue.config.js中配置gzip,设置filename:'[path].gz[query]',出现报错如下:ERROR in Conflict: Multiple assets emit different content to the same filename static/js/.gz

可能因为插件版本不同原因

"compression-webpack-plugin": "^10.0.0",  //当前项目插件版本
new CompressionWebpackPlugin({
        filename:'[path].gz[query]',  //配置这个出现报错
        algorithm: 'gzip',
        test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),
        threshold: 10240,
        minRatio: 0.8,
        deleteOriginalAssets: false // 删除源文件
      })

只需要把filename设置如下,就不会出现报错。

filename:'[path][base].gz'

猜你喜欢

转载自blog.csdn.net/pinhmin/article/details/129026491
今日推荐