Я использовал webpack2 для создания своего приложения, но при использовании uglify-js + uglifyjs-webpack-plugin. У меня есть некоторые проблемы:
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)
Конфигурация webpack может помочь вам:
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'
}
Что означает "reset"? Я не могу найти ответ нигде... Спасибо!