New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: Cannot read property '_walk' of null #3274
Comments
We're experiencing the same problem because we depend on
|
this variation works:
something to do with closures maybe? |
How do we fix this… if we're just using Gulp? |
stream.pipe(uglify({ keep_fnames: true })) if you don't mind your function names not being obfuscated. |
we made the following config change |
Added workaround for issue mishoo/UglifyJS#3274
We are getting the following issue when minify the node_modules/mysql2/lib/commands/index.js []
TypeError: Cannot read property 'replace' of undefined
at make_string (eval at <anonymous> (/Users/NatarajanG/BitBucket/mission/mission.shrink/node_modules/uglify-es/tools/node.js:21:1), <anonymous>:5645:19)
at encode_string (eval at <anonymous> (/Users/NatarajanG/BitBucket/mission/mission.shrink/node_modules/uglify-es/tools/node.js:21:1), <anonymous>:5689:19)
at Object.print_string (eval at <anonymous> (/Users/NatarajanG/BitBucket/mission/mission.shrink/node_modules/uglify-es/tools/node.js:21:1), <anonymous>:6107:27)
at eval (eval at <anonymous> (/Users/NatarajanG/BitBucket/mission/mission.shrink/node_modules/uglify-es/tools/node.js:21:1), <anonymous>:6396:16)
at doit (eval at <anonymous> (/Users/NatarajanG/BitBucket/mission/mission.shrink/node_modules/uglify-es/tools/node.js:21:1), <anonymous>:6168:13)
at AST_Directive.eval (eval at <anonymous> (/Users/NatarajanG/BitBucket/mission/mission.shrink/node_modules/uglify-es/tools/node.js:21:1), <anonymous>:6175:13)
at eval (eval at <anonymous> (/Users/NatarajanG/BitBucket/mission/mission.shrink/node_modules/uglify-es/tools/node.js:21:1), <anonymous>:6438:22)
at Array.forEach (<anonymous>)
at display_body (eval at <anonymous> (/Users/NatarajanG/BitBucket/mission/mission.shrink/node_modules/uglify-es/tools/node.js:21:1), <anonymous>:6429:14)
at eval (eval at <anonymous> (/Users/NatarajanG/BitBucket/mission/mission.shrink/node_modules/uglify-es/tools/node.js:21:1), <anonymous>:6463:9) []
node_modules/mysql2/lib/commands/ping.js [] |
same code work for a project and not for the other... |
Bug report
Uglify fails to minify some code and instead errors with the above error. Seems to be affecting several people using uglify, but I couldn't see an open issue in this repo, so thought I'd bring it to your attention / open this issue to track.
terser/terser#120
ember-cli/ember-cli#8075
angular/angular-cli#12414
There was an old bug from 2017 which was supposedly fixed with the same error message:
#1609
Happens when running uglify from the CLI or through uglifyjs-webpack-plugin
Running with
--keep-fnames
or addingcollapse_vars
to the compress webpack config options works around the issue:Uglify version (
uglifyjs -V
)3.4.9
(Also tested with 3.3.28 & a few in between, they all error)
JavaScript input
I can't share my company's code, see terser/terser#120 (comment) for a reproducible example.
The
uglifyjs
CLI command executed orminify()
options used.../../node_modules/.bin/uglifyjs --compress --verbose client-6a7cff1a.js
JavaScript output or error produced.
...<hundreds of warnings because I used --verbose>
WARN: Dropping unused variable gpu [client-6a7cff1a.js:59688,12]
WARN: Dropping unused variable retina [client-6a7cff1a.js:59710,16]
WARN: Collapsing fe [client-6a7cff1a.js:59777,19]
WARN: Dropping unused variable fe [client-6a7cff1a.js:59776,16]
WARN: Collapsing d [client-6a7cff1a.js:59776,21]
WARN: Collapsing e [client-6a7cff1a.js:59775,20]
ERROR: Cannot read property '_walk' of null
at AST_Dot.eval (eval at (/path/to/my/project/node_modules/uglify-js/tools/node.js:21:1), :873:29)
at TreeWalker._visit (eval at (/path/to/my/project/node_modules/uglify-js/tools/node.js:21:1), :1151:21)
at AST_Dot._walk (eval at (/path/to/my/project/node_modules/uglify-js/tools/node.js:21:1), :872:24)
at AST_VarDef.eval (eval at (/path/to/my/project/node_modules/uglify-js/tools/node.js:21:1), :820:40)
at TreeWalker._visit (eval at (/path/to/my/project/node_modules/uglify-js/tools/node.js:21:1), :1151:21)
at AST_VarDef._walk (eval at (/path/to/my/project/node_modules/uglify-js/tools/node.js:21:1), :818:24)
at AST_Var.eval (eval at (/path/to/my/project/node_modules/uglify-js/tools/node.js:21:1), :801:32)
at TreeWalker._visit (eval at (/path/to/my/project/node_modules/uglify-js/tools/node.js:21:1), :1151:21)
at AST_Var._walk (eval at (/path/to/my/project/node_modules/uglify-js/tools/node.js:21:1), :798:24)
at walk_body (eval at (/path/to/my/project/node_modules/uglify-js/tools/node.js:21:1), :448:17)
The text was updated successfully, but these errors were encountered: