Esbuild doesn't currently seem to remove unused pure functions or variables. For example this input:
(function() {
var x = 2;
function foo() {
console.log('foo');
}
function bar() {
console.log('bar');
}
foo();
})();
Currently produces this output:
(function(){var n=2;function o(){console.log("foo")}function c(){console.log("bar")}o()})();
Whereas terser produces:
That's obviously even more optimized in this case to get rid of the function declaration entirely, but I'd accept at least just removing the unused vars and functions. We're considering esbuild as an alternative minifier in Parcel, but we don't currently have our own DCE pass and rely on terser for this. This means that the output will typically be much larger than it is currently without either Parcel implementing its own DCE or esbuild doing so.
Esbuild doesn't currently seem to remove unused pure functions or variables. For example this input:
Currently produces this output:
Whereas terser produces:
That's obviously even more optimized in this case to get rid of the function declaration entirely, but I'd accept at least just removing the unused vars and functions. We're considering esbuild as an alternative minifier in Parcel, but we don't currently have our own DCE pass and rely on terser for this. This means that the output will typically be much larger than it is currently without either Parcel implementing its own DCE or esbuild doing so.