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
var path = 'file';
path += '-min';
path += '.';
if (is_mjs) {
path += 'mjs';
} else {
path += 'js';
}
console.log(path)expected:
console.log('file-min.' + (is_mjs ? 'mjs' : 'js'))received:
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,
- var + assignment
var path = 'file'; path += '-min'; - assignment + assignment
path += '-a';path += '-b'; - if folding
related #26635
Source: oxc-project/oxc