node - webpack3 运行npm run build构建出现UglifyJs错误

查看:2031
本文介绍了node - webpack3 运行npm run build构建出现UglifyJs错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

ERROR in static/js/vendor.fa36df785ae0ec71d7c1.js from UglifyJs
TypeError: Cannot read property 'reset' of undefined

搜索了一圈,发现TypeError: Cannot read property 'reset' of undefined,这个满多的,都说是uglify-js3不支持webpack插件,可我的版本并不是uglifyjs3

环境:
npm 5.1.0
node 7.10
webpack3
uglify-js
└─┬ uglifyjs-webpack-plugin@0.4.6
└── uglify-js@2.8.29


解决,感谢 TheLarkInn大神

> node build/build.js

⠸ building for production...(node:32063) DeprecationWarning: Chunk.modules is deprecated. Use Chunk.getNumberOfModules/mapModules/forEachModule/containsModule instead.
⠴ building for production...
Starting to optimize CSS...
Processing static/css/app.85a191c53ac2f7b785c0155b188bd6ea.css...
Processed static/css/app.85a191c53ac2f7b785c0155b188bd6ea.css, before: 411283, after: 399673, ratio: 97.18%
Hash: 298f05edf0b832c33339
Version: webpack 3.0.0
Time: 66554ms
                                                 
 Asset       Size  Chunks                    Chunk Names
                        ...       

  Build complete.

解决方案

You can fix this by using the most recent beta version of uglifyjs-webpack-plugin. Our team is working to remove completely the UglifyJsPlugin from within webpack, and instead have it as a standalone plugin.

If you do yarn add uglifyjs-webpack-plugin@beta --dev or npm install uglifyjs-webpack-plugin@beta --save-dev you should receive the latest beta which does successfully minify es6 syntax. We are hoping to have this released from beta extremely soon, however it should save you from errors for now!

Here is an example of this:

这篇关于node - webpack3 运行npm run build构建出现UglifyJs错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆