Skip to content
This repository has been archived by the owner. It is now read-only.

Cannot read property 'reset' of undefined #31

Closed
KokoTa opened this issue May 10, 2017 · 13 comments
Closed

Cannot read property 'reset' of undefined #31

KokoTa opened this issue May 10, 2017 · 13 comments

Comments

@KokoTa
Copy link

@KokoTa KokoTa commented May 10, 2017

ERROR in bundle.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 next (F:\Github\Program\My-test\Webpack\www2\node_modules\_tapable@0.2.6@tapable\lib\Tapable.js:138:11)
    at Compilation.compilation.plugin.callback (F:\Github\Program\My-test\Webpack\www2\node_modules\_webpack@2.5.1@webpack\lib\ProgressPlugin.js:113:6)
    at Compilation.applyPluginsAsyncSeries (F:\Github\Program\My-test\Webpack\www2\node_modules\_tapable@0.2.6@tapable\lib\Tapable.js:142:13)
    at sealPart2 (F:\Github\Program\My-test\Webpack\www2\node_modules\_webpack@2.5.1@webpack\lib\Compilation.js:631:9)
    at next (F:\Github\Program\My-test\Webpack\www2\node_modules\_tapable@0.2.6@tapable\lib\Tapable.js:138:11)
    at Compilation.compilation.plugin (F:\Github\Program\My-test\Webpack\www2\node_modules\_webpack@2.5.1@webpack\lib\ProgressPlugin.js:109:6)
    at Compilation.applyPluginsAsyncSeries (F:\Github\Program\My-test\Webpack\www2\node_modules\_tapable@0.2.6@tapable\lib\Tapable.js:142:13)
    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)

What's 'reset' mean?

@bebraw

This comment has been minimized.

Copy link
Contributor

@bebraw bebraw commented May 10, 2017

Impossible to say. There's not enough information to debug.

@orlv

This comment has been minimized.

Copy link

@orlv orlv commented May 10, 2017

UglifyJS v3 has a new, backwards incompatible API. I guess it has no methods like uglify.base54.reset() or uglify.parse()

@bebraw

This comment has been minimized.

Copy link
Contributor

@bebraw bebraw commented May 10, 2017

Ah, you are using Uglify 3... The plugin doesn't support Uglify 3 yet.

@KokoTa

This comment has been minimized.

Copy link
Author

@KokoTa KokoTa commented May 10, 2017

Thanks! I changed v2.8.23 and it can work:)

@bebraw

This comment has been minimized.

Copy link
Contributor

@bebraw bebraw commented May 10, 2017

Ok, track #32 for progress with UglifyJS 3. I expect that will be a new major version of the plugin as the API it provides has to change as well most likely.

@kwelch

This comment has been minimized.

Copy link

@kwelch kwelch commented Jul 26, 2017

Question
I am seeing this when using Uglify from webpack.optimize.UglifyJsPlugin in webpack@3.4.1 is there something I should be doing in particular?

Here is the repo: https://github.com/kwelch/simple-react-starter (using the build script)

@kwelch

This comment has been minimized.

Copy link

@kwelch kwelch commented Aug 4, 2017

@bebraw I am still having this issue. Should we re-open this ticket or create a new one? You should be able to use my repo from my previous comment to reproduce the error message.
I have created a branch to ensure master does no update prior to you getting a chance to look at this.

Update:
After further review, (aka I commented it out of my config). I am still getting this error.

Here is my build script:
cross-env NODE_ENV=production webpack -p --config webpack.config.production.js

The app is as bare-bones that I could think of.

@michael-ciniawsky

This comment has been minimized.

Copy link
Member

@michael-ciniawsky michael-ciniawsky commented Aug 4, 2017

@kwelch Try the beta which supports uglify-es && parallelization npm i -D uglifyjs-webpack-plugin@beta

@kwelch

This comment has been minimized.

Copy link

@kwelch kwelch commented Aug 4, 2017

@michael-ciniawsky
I pushed a new branch that has a direct dependency on the beta version of the plugin and was presented with a new error.
This is output for each bundle.

Error:

ERROR in main.d7ce55c1ec45ae99acd0.js from UglifyJs
TypeError: Cannot read property 'sections' of null
    at new SourceMapConsumer (/Users/welchk/_git/oss/simple-react-starter/node_modules/webpack/node_modules/source-map/lib/source-map-consumer.js:20:19)
    at /Users/welchk/_git/oss/simple-react-starter/node_modules/webpack/node_modules/uglifyjs-webpack-plugin/dist/index.js:75:21
    at Array.forEach (native)
    at Compilation.<anonymous> (/Users/welchk/_git/oss/simple-react-starter/node_modules/webpack/node_modules/uglifyjs-webpack-plugin/dist/index.js:54:20)
    at next (/Users/welchk/_git/oss/simple-react-starter/node_modules/tapable/lib/Tapable.js:186:14)
    at /Users/welchk/_git/oss/simple-react-starter/node_modules/uglifyjs-webpack-plugin/dist/index.js:225:13
    at step (/Users/welchk/_git/oss/simple-react-starter/node_modules/uglifyjs-webpack-plugin/dist/uglify/index.js:110:11)
    at done (/Users/welchk/_git/oss/simple-react-starter/node_modules/uglifyjs-webpack-plugin/dist/uglify/index.js:120:22)
    at /Users/welchk/_git/oss/simple-react-starter/node_modules/uglifyjs-webpack-plugin/dist/uglify/index.js:125:15
    at _class.worker (/Users/welchk/_git/oss/simple-react-starter/node_modules/uglifyjs-webpack-plugin/dist/uglify/index.js:78:13)
    at enqueue (/Users/welchk/_git/oss/simple-react-starter/node_modules/uglifyjs-webpack-plugin/dist/uglify/index.js:117:18)
    at /Users/welchk/_git/oss/simple-react-starter/node_modules/uglifyjs-webpack-plugin/dist/uglify/index.js:134:11
    at Array.forEach (native)
    at _class.runTasks (/Users/welchk/_git/oss/simple-react-starter/node_modules/uglifyjs-webpack-plugin/dist/uglify/index.js:114:13)
    at Compilation.<anonymous> (/Users/welchk/_git/oss/simple-react-starter/node_modules/uglifyjs-webpack-plugin/dist/index.js:151:18)
    at Compilation.applyPluginsAsyncSeries (/Users/welchk/_git/oss/simple-react-starter/node_modules/tapable/lib/Tapable.js:188:13)
    at self.applyPluginsAsync.err (/Users/welchk/_git/oss/simple-react-starter/node_modules/webpack/lib/Compilation.js:640:10)
    at Compilation.applyPluginsAsyncSeries (/Users/welchk/_git/oss/simple-react-starter/node_modules/tapable/lib/Tapable.js:177:46)
    at sealPart2 (/Users/welchk/_git/oss/simple-react-starter/node_modules/webpack/lib/Compilation.js:636:9)
    at Compilation.applyPluginsAsyncSeries (/Users/welchk/_git/oss/simple-react-starter/node_modules/tapable/lib/Tapable.js:177:46)
    at Compilation.seal (/Users/welchk/_git/oss/simple-react-starter/node_modules/webpack/lib/Compilation.js:579:8)
    at applyPluginsParallel.err (/Users/welchk/_git/oss/simple-react-starter/node_modules/webpack/lib/Compiler.js:514:17)
    at /Users/welchk/_git/oss/simple-react-starter/node_modules/tapable/lib/Tapable.js:271:11
    at _addModuleChain (/Users/welchk/_git/oss/simple-react-starter/node_modules/webpack/lib/Compilation.js:481:11)
    at processModuleDependencies.err (/Users/welchk/_git/oss/simple-react-starter/node_modules/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)
@michael-ciniawsky

This comment has been minimized.

Copy link
Member

@michael-ciniawsky michael-ciniawsky commented Aug 4, 2017

Try without devtool especially cheap-source-maps don't work with this plugin

@kwelch

This comment has been minimized.

Copy link

@kwelch kwelch commented Aug 4, 2017

Good to know thanks!

@kwelch

This comment has been minimized.

Copy link

@kwelch kwelch commented Aug 5, 2017

@michael-ciniawsky I took out all settings about related to devtool and still same reset error.

@alejuanito

This comment has been minimized.

Copy link

@alejuanito alejuanito commented Aug 22, 2017

You must install uglify2
npm i uglify-js@2 -D

IvanWoo added a commit to IvanWoo/homebrew-apple-cider that referenced this issue Jul 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
6 participants
You can’t perform that action at this time.