You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is not technically a bug as the code is valid, however it is the opposite of being minified (it's larger than original not counting whitespace).
When using the --compress option and using a local variable that holds a string literal as a computed property name in an object, it is replaced again with its literal value, which results in larger file even than the original.
However, when enabling --compress it strangely replaces the computed property with its literal, resulting in larger input:
$ npx uglify-js file.js --compress
let r=c=>{var P="foobar";return[{foobar:c[P]+1},{foobar:c[P]+2},{foobar:c[P]+3},{foobar:c[P]+4},{foobar:c[P]+5}]};
It's interesting to note that if the property definition P is made at the top level, then even --compress leaves the computed property names. So I see the issue only when using --compress with local variables in computed properties.
The text was updated successfully, but these errors were encountered:
This is not technically a bug as the code is valid, however it is the opposite of being minified (it's larger than original not counting whitespace).
When using the
--compress
option and using a local variable that holds a string literal as a computed property name in an object, it is replaced again with its literal value, which results in larger file even than the original.Uglify version (
uglifyjs -V
)uglify-js 3.19.3
JavaScript input
file.js
:The
uglifyjs
CLI command executed orminify()
options used.npx uglify-js file.js --compress
JavaScript output or error produced.
When running without
--compress
it correctly leaves the computed property:However, when enabling
--compress
it strangely replaces the computed property with its literal, resulting in larger input:It's interesting to note that if the property definition
P
is made at the top level, then even--compress
leaves the computed property names. So I see the issue only when using--compress
with local variables in computed properties.The text was updated successfully, but these errors were encountered: