From here, I can't seem to use this
uglifyjs mtool.js -c -m --mangle-props regex=/_$/ -o mtool.min.js
as it produces an error:
ERROR: regex.test is not a function at should_mangle (eval at (C:\Users\Doge\AppData\Roaming\npm\node_modules\uglify-js\tools\node.js:21:1), :10864:29) at add (eval at (C:\Users\Doge\AppData\Roaming\npm\node_modules\uglify-js\tools\node.js:21:1), :10874:14) at TreeWalker.eval [as visit] (eval at (C:\Users\Doge\AppData\Roaming\npm\node_modules\uglify-js\tools\node.js:21:1), :10820:13) at TreeWalker._visit (eval at (C:\Users\Doge\AppData\Roaming\npm\node_modules\uglify-js\tools\node.js:21:1), :1213:24) at AST_ObjectKeyVal._walk (eval at (C:\Users\Doge\AppData\Roaming\npm\node_modules\uglify-js\tools\node.js:21:1), :1049:24) at AST_Object.eval (eval at (C:\Users\Doge\AppData\Roaming\npm\node_modules\uglify-js\tools\node.js:21:1), :1036:31) at TreeWalker._visit (eval at (C:\Users\Doge\AppData\Roaming\npm\node_modules\uglify-js\tools\node.js:21:1), :1217:21) at AST_Object._walk (eval at (C:\Users\Doge\AppData\Roaming\npm\node_modules\uglify-js\tools\node.js:21:1), :1033:24) at AST_Call.eval (eval at (C:\Users\Doge\AppData\Roaming\npm\node_modules\uglify-js\tools\node.js:21:1), :902:25) at TreeWalker._visit (eval at (C:\Users\Doge\AppData\Roaming\npm\node_modules\uglify-js\tools\node.js:21:1), :1217:21)
Did I miss installing dependency or something? I tried searching for this but can't find any references to solve the problem.
All's fine. I can uglify my script(s) without problem up until I add regex argument. Thanks.
Solely using,
regex=/myExpression/
will not work.
In using the regex parameter given that uglifyJS version, the value should be a complete expression.
regex='/^stackoverflow$/g;'
It successfully uglified my target variables accordingly.