I used webpack2 to build my app, but when use uglify-js + uglifyjs-webpack-plugin.I have some problems:
ERROR in vendors.js from UglifyJs
TypeError: Cannot read property 'reset' of undefined
at F:\Github\Program\My-test\Webpack\www2\node_modules\[email protected]@uglifyjs-webpack-plugin\dist\index.js:99:22
at F:\Github\Program\My-test\Webpack\www2\node_modules\[email protected]@uglifyjs-webpack-plugin\dist\index.js:231:9
at Array.forEach (native)
at Compilation.<anonymous> (F:\Github\Program\My-test\Webpack\www2\node_modules\[email protected]@uglifyjs-webpack-plugin\dist\index.js:54:19)
at Compilation.applyPluginsAsyncSeries (F:\Github\Program\My-test\Webpack\www2\node_modules\[email protected]@tapable\lib\Tapable.js:142:13)
at self.applyPluginsAsync.err (F:\Github\Program\My-test\Webpack\www2\node_modules\[email protected]@webpack\lib\Compilation.js:635:10)
at Compilation.applyPluginsAsyncSeries (F:\Github\Program\My-test\Webpack\www2\node_modules\[email protected]@tapable\lib\Tapable.js:131:46)
at sealPart2 (F:\Github\Program\My-test\Webpack\www2\node_modules\[email protected]@webpack\lib\Compilation.js:631:9)
at Compilation.applyPluginsAsyncSeries (F:\Github\Program\My-test\Webpack\www2\node_modules\[email protected]@tapable\lib\Tapable.js:131:46)
at Compilation.seal (F:\Github\Program\My-test\Webpack\www2\node_modules\[email protected]@webpack\lib\Compilation.js:579:8)
at F:\Github\Program\My-test\Webpack\www2\node_modules\[email protected]@webpack\lib\Compiler.js:493:16
at F:\Github\Program\My-test\Webpack\www2\node_modules\[email protected]@tapable\lib\Tapable.js:225:11
at _addModuleChain (F:\Github\Program\My-test\Webpack\www2\node_modules\[email protected]@webpack\lib\Compilation.js:481:11)
at processModuleDependencies.err (F:\Github\Program\My-test\Webpack\www2\node_modules\[email protected]@webpack\lib\Compilation.js:452:13)
at _combinedTickCallback (internal/process/next_tick.js:73:7)
at process._tickCallback (internal/process/next_tick.js:104:9)
The webpack config maybe give some help to you:
module.exports = {
entry: {
app: path.resolve(APP, 'index.js'),
vendors: ['jquery', 'moment']
},
output: {
path: BUILD,
filename: 'bundle.js'
},
plugins: [
new HTMLwebpackPlugin({
title: 'Generate by webpack'
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'vendors',
filename: 'vendors.js'
}),
new UglifyJSPlugin({
compress: true
})
],
module: {
loaders: [
{
test: /\.scss$/,
loaders: 'style-loader!css-loader?sourceMap!sass-loader?sourceMap',
include: APP
},
{
test: /\.(jpg|png)$/,
loaders: 'url-loader?limit=40000'
},
{
test: /\.jsx?$/,
loader: 'babel-loader',
include: APP,
query: {
presets: ['es2015', {"modules": false}]
}
}
]
},
devtool: 'eval-source-map'
}
What's the 'reset' mean? I can't find answer in anywhere... Thanks!
Its working with webpack3 + angular4 just use
npm install [email protected] --save-dev
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With