Changelog: swc v1.1.42


Dead code elimination (#763)#

Previously, dead code elimination pass of swc dropped some used imports. It was cause by iteration order.

In the code below,

import { A, B } from "library";
const arr = [A, B];
console.log(B); => console.log(v));

after console.log(B) and are evaluated, the import statement is visited and incorrectly dropped A.

This is fixed by extracting import handling as a new phase. The new version of swc does not drop imports while every other things are evaluated.