#27205·oxc

minifier: string merge for consequent assignment exprs

Author: armano2Created Sep 29, 2026Updated Sep 30, 2026
LabelsA-minifier

while reviewing some old codebase i noticed that we are missing some optimizations for += and folding if to += seem to be not working

javascript
var path = 'file';
path += '-min';
path += '.';
if (is_mjs) {
  path += 'mjs';
} else {
  path += 'js';
}
console.log(path)

expected:

javascript
console.log('file-min.' + (is_mjs ? 'mjs' : 'js'))

received:

javascript
var path = "file";
path += "-min", path += ".", is_mjs ? path += "mjs" : path += "js", console.log(path);

there are 3 types of optimizations we should implement here,

  1. var + assignment var path = 'file'; path += '-min';
  2. assignment + assignment path += '-a';path += '-b';
  3. if folding

related #26635