Packing WebPACK acceleration given by webpack-parallel-uglify-plugin

 

Parts pulled from the new code. npm install, npm run dev no problem, but npm run build on the above error report

Checked a lot of information, do not solve the above problem, I do not know what went wrong, but it certainly is a packed file error

I learned that behind ParallelUglifyPlugin accelerated packaged wrong. Or to analyze the reasons being given

1, `warnings` is not a supported option means: do not support the" warning "option.

Being given the screenshot above, there are some yellow warning codes

That query configuration file packaged under the build file, where there is 'warning'.

1, webpack.dll.conf.js file

new webpack.optimize.UglifyJsPlugin({
      compress: {
        warnings: false
      }
    })

But when I perform npm run dll's, and there is no error, then the problem is that webpack.prod.conf.js file inside the 'warning'

2、webpack.prod.conf.js

 new ParallelUglifyPlugin({
      cacheDir: '.cache/',   // 设置缓存路径,不改动的调用缓存,第二次及后面build时提速
      uglifyJS:{
        output: {
          comments: false
        },
        compress: {
          //是否在UglifyJS删除没有用到的代码时输出警告信息,默认为输出,可以设置为false关闭这些作用
          //  不大的警告
          warnings: false  
          
        }
      }
    }),

那么问题怎么改呢?我们看  ParallelUglifyPlugin 官方文档 

将:

compress: {
warnings: false
}
改为:
warnings: false

 new ParallelUglifyPlugin({
      cacheDir: '.cache/',   // 设置缓存路径,不改动的调用缓存,第二次及后面build时提速
      uglifyJS:{
        output: {
          comments: false
        },
        warnings: false
        // compress: {
        //   warnings: false
        // }
      }
    }),

 再次npm run build 就成功了。

 总结:"webpack": "2.7.0", "webpack-parallel-uglify-plugin": "1.1.0"。

之前的打包是没有问题的,删除 node_modules 重新下载再打包,一次打包报错了,之后打包就一直报错,并且我是锁定了 package.json 中的包版本,npm install不会更新 package.json 中的包版本,我想是不是他们所依赖的某个包更新或者弃用了。

Guess you like

Origin www.cnblogs.com/qiu-Ann/p/11390111.html