Closed jameswilddev closed 4 years ago
I've written a test for this but it doesn't fail? Very strange. https://github.com/mishoo/UglifyJS/compare/master...jameswilddev:issue-4010
By default uglify-js
treats input as complete statements, i.e. in your example the evaluated value of testConstantA * 10 + testConstantB.join('::')
will be discarded since it is not being fed into any function arguments or variable assignments etc.
I assume what you want here is the --compress expression
:
$ echo "testConstantA * 10 + testConstantB.join('::')" | uglifyjs -d testConstantA=47
testConstantB.join("::");
$ echo "testConstantA * 10 + testConstantB.join('::')" | uglifyjs -d testConstantA=47 -c expression
470+testConstantB.join("::");
Ah, ok, I think I understand where the code which led to this example is going wrong. Thanks for the help!
Bug report or feature request?
Bug report.
Uglify version (
uglifyjs -V
)uglify-js 3.10.0
JavaScript input
Given that testConstantA is 47:
The
uglifyjs
CLI command executed orminify()
options used.JavaScript output or error produced.