Hässlich machen, Nicht Lesen-Eigenschaft 'reset' undefined

Ich verwendet webpack2 zu bauen my app, aber Wann verwenden Sie verunstalten-js + uglifyjs-webpack-plugin.Ich habe einige Probleme:

ERROR in vendors.js from UglifyJs
TypeError: Cannot read property 'reset' of undefined
at F:\Github\Program\My-test\Webpack\www2\node_modules\_uglifyjs-webpack-plugin@0.4.3@uglifyjs-webpack-plugin\dist\index.js:99:22
at F:\Github\Program\My-test\Webpack\www2\node_modules\_uglifyjs-webpack-plugin@0.4.3@uglifyjs-webpack-plugin\dist\index.js:231:9
at Array.forEach (native)
at Compilation.<anonymous> (F:\Github\Program\My-test\Webpack\www2\node_modules\_uglifyjs-webpack-plugin@0.4.3@uglifyjs-webpack-plugin\dist\index.js:54:19)
at Compilation.applyPluginsAsyncSeries (F:\Github\Program\My-test\Webpack\www2\node_modules\_tapable@0.2.6@tapable\lib\Tapable.js:142:13)
at self.applyPluginsAsync.err (F:\Github\Program\My-test\Webpack\www2\node_modules\_webpack@2.5.1@webpack\lib\Compilation.js:635:10)
at Compilation.applyPluginsAsyncSeries (F:\Github\Program\My-test\Webpack\www2\node_modules\_tapable@0.2.6@tapable\lib\Tapable.js:131:46)
at sealPart2 (F:\Github\Program\My-test\Webpack\www2\node_modules\_webpack@2.5.1@webpack\lib\Compilation.js:631:9)
at Compilation.applyPluginsAsyncSeries (F:\Github\Program\My-test\Webpack\www2\node_modules\_tapable@0.2.6@tapable\lib\Tapable.js:131:46)
at Compilation.seal (F:\Github\Program\My-test\Webpack\www2\node_modules\_webpack@2.5.1@webpack\lib\Compilation.js:579:8)
at F:\Github\Program\My-test\Webpack\www2\node_modules\_webpack@2.5.1@webpack\lib\Compiler.js:493:16
at F:\Github\Program\My-test\Webpack\www2\node_modules\_tapable@0.2.6@tapable\lib\Tapable.js:225:11
at _addModuleChain (F:\Github\Program\My-test\Webpack\www2\node_modules\_webpack@2.5.1@webpack\lib\Compilation.js:481:11)
at processModuleDependencies.err (F:\Github\Program\My-test\Webpack\www2\node_modules\_webpack@2.5.1@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)

Dem webpack config vielleicht geben einige helfen Ihnen:

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'
}

Was ist der "reset" gemeint? Ich kann nicht finden die Antwort in überall...
Danke!

  • Senden Sie Ihre index.js bei F:\Github\Program\My-test\Webpack\www2\node_modules\uglifyjs-webpack-plugin\dist\index.js
  • Ich hatte das gleiche problem. Als Problemumgehung: Installieren Sie 3.0.0 statt 3.0.3 und das Problem geht Weg für heute...
  • Dies ist Thema Webpack 2 und UglifyJS 3. Verwenden Sie einfach UglifyJS 2.8 mit Webpack 2.
InformationsquelleAutor Ko Ko | 2017-05-10
Schreibe einen Kommentar