从新拉了份代码。npm install 、npm run dev 都没有问题,但是npm run build 就报上面的错误了

查了好多资料,都没有解决上面的问题,也不知道是哪里出了问题,但是可以肯定就是打包文件出错了

后面才知道是 ParallelUglifyPlugin 加速打包 出错了 。还是要分析报错的原因

1、`warnings` is not a supported option   意思是:不支持“警告”选项。

上面报错的截图,就有一段黄色的警告代码

那就查询 build文件下打包的配置文件,哪里有‘warning’。

1、webpack.dll.conf.js文件

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

但是 我在执行 npm run dll 的时候,并没有报错,那么出现问题的是在于 webpack.prod.conf.js文件里面的‘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 中的包版本,我想是不是他们所依赖的某个包更新或者弃用了。

webpack 用 webpack-parallel-uglify-plugin 加速打包报错的更多相关文章

  1. webpack 打包报错:One CLI for webpack must be installed. These are recommended choices, delivered as separate packages

    webpack 打包报错: One CLI for webpack must be installed. These are recommended choices, delivered as sep ...

  2. [one day one question] webpack 打包报错 Cannot assign to read only property 'exports' of object '#<Object>'

    问题描述: webpack 打包报错 Cannot assign to read only property 'exports' of object '#<Object>',这怎么破? 解 ...

  3. 关于Webpack打包报错Class constructor FileManager cannot be invoked without 'new'

    前端代码部署一直是自己打包之后将文件用FileZilla上传到服务器上,现在改用运维基于到k8s docker镜像的发布,前端打包报错如下: 经查资料,报错原因是less升级导致的Bug 尝试升级le ...

  4. 在把webpack作为本地开发依赖安装的时候报错

    在把webpack作为本地开发依赖安装的时候报错 Refusing to install webpack as a dependency of itself 原因是package.json里的name ...

  5. vue-cli 打包报错:Unexpected token: punc (()

    vue-cli 打包报错: ERROR in static/js/vendor.ed7d2353f79d28a69f3d.js from UglifyJs Unexpected token: punc ...

  6. maven install 打包 报错 Cannot run program "gpg.exe": CreateProcess error

    打包报错, mvn install后加上参数-Dgpg.skip,例如:mvn install -Dgpg.skip   即可解决. 我们也可以去掉 这个 插件   <plugin>    ...

  7. No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? idea maven 打包报错问题解决

    mvn clean install -X -Dmaven.test.skip=true -P dev 打包报错:No compiler is provided in this environment. ...

  8. 解决xcode10打包报错:That command depends on command in Target ‘xxx’:scrpit phase"[CP] Copy Pods Resources"

    问题:使用xcode10打包报错,提示 error:Multiple commands produce ‘xxxx/xxx.app’ 1)Target ‘xx’ has create director ...

  9. Mac Angular打包报错xcode-select: error: tool 'xcodebuild' requires Xcode

    Mac Angular打包报错: Error: xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer ...

随机推荐

  1. idou老师教你学Istio 15:Istio实现双向TLS的迁移

    在Istio中,双向TLS是传输身份验证的完整堆栈解决方案,它为每个服务提供可跨集群的强大身份.保护服务到服务通信和最终用户到服务通信,以及提供密钥管理系统.本文阐述如何在不中断通信的情况下,把现存I ...

  2. python3 模块和包

    一.模块(Module)和包(Package) 1.模块:一个包含所有你定义的函数和变量的文件,其后缀名是 .py ,一个.py文件就是一个模块 2.包:一定包含 __init__.py模块 的文件夹 ...

  3. Ubuntu死机解决方法汇总

    为什么不建议强制关机 如果长按电源按键强制关机,有可能损坏硬件或者丢失数据,甚至导致磁盘坏道! 其实, 大部分时候的死机是假死, 不是真死... 有时候鼠标还能动呢. 还有一个原因: 对于平时忠贞不二 ...

  4. Why Go? – Key advantages you may have overlooked

    Why Go? – Key advantages you may have overlooked yourbasic.org/golang Go makes it easier (than Java ...

  5. 转发:i p _ f o r w a r d函数

    转发:i p _ f o r w a r d函数到达非最终目的地系统的分组需要被转发.只有当 i p f o r w a r d i n g非零或当分组中包含源路由时,i p i n t r才调用实现 ...

  6. Springboot注解@ServletComponentScan和@ComponentScan(转)

    一.SpringBoot中使用Servlet在SpringBootApplication上使用@ServletComponentScan注解后,Servlet.Filter.Listener可以直接通 ...

  7. jquery 下载

    jquery下载所有版本(实时更新) 摘自:http://www.jq22.com/jquery-info122 插件描述:jquery下载,实时更新jquery1.2到最新3.2.1所有版本下载 j ...

  8. Spring Boot 如何部署到 Linux 中的服务

    打包完成后的 Spring Boot 程序如何部署到 Linux 上的服务? 你可以参考官方的有关部署 Spring Boot 为 Linux 服务的文档. 文档链接如下: https://docs. ...

  9. pat 甲级 1064 ( Complete Binary Search Tree ) (数据结构)

    1064 Complete Binary Search Tree (30 分) A Binary Search Tree (BST) is recursively defined as a binar ...

  10. 【概率论】3-1:随机变量和分布(Random Variables and Discrete Distributions)

    title: [概率论]3-1:随机变量和分布(Random Variables and Discrete Distributions) categories: Mathematic Probabil ...