ERROR in static/js/vendor.fa36df785ae0ec71d7c1.js from UglifyJs
TypeError: Cannot read property 'reset' of undefined
搜索了一圈,发现TypeError: Cannot read property 'reset' of undefined
,这个满多的,都说是uglify-js
3不支持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 ofuglifyjs-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
ornpm 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: