Page MenuHomePhabricator

minification of expressions using null coalescent operator produces invalid JS code.
Closed, DuplicatePublicBUG REPORT

Description

  • wikimedia/minify 2.2.6 Minification of JavaScript code and CSS stylesheets.

When minifying js code that uses the "null coalescent operator", the generated minified code is broken and gives random js error.

e.g. var item = expression ?? "value if expression is null"

A workaround is to add parenthesis around the whole expression:

e.g. var item = (expression ?? "value if expression is null")