[Pkg-javascript-devel] use uglify-js 3 when possible, instead of terser

Pirate Praveen praveen at onenetbeyond.org
Fri Nov 6 10:37:45 GMT 2020



On Fri, Nov 6, 2020 at 11:26, Jonas Smedegaard <dr at jones.dk> wrote:
> I recommend to use uglify-js 3 instead of terser, when possible.
> 
>  * Terser can minify modern code (uglify-js 3 only ES5).
>  * Uglify-js 3 needs 3 nodejs packages to build (terser needs 134).
>  * Uglify-js 3 package is up-to-date (terser is 16 months behind).
> 
> Therefore, for code that is written as or transpiled to ES5, better 
> use
> uglify-js 3 to minify it: Your package then a) gets minified using
> newest upstream knowledge, and b) reduces risk of getting caught in 
> in a
> larger package migration.
> 
> Specifically, do *not* casually switch a package from uglify-js 3 to
> terser when helping out others in the JavaScript team: Please ask 
> first.
> 
> (avoid uglifyjs 2, however: It is ancient and unmaintained code!)

Though with more and more browsers supporting ES6 features natively, 
transpiling to ES5 may not be necessary for many packages. If we have 
to maintain terser anyway and it being a superset of uglifyjs, I don't 
see the reason for new packages to use uglify-js. But as you requested, 
if some package is using uglify-js already, it may be fine to keept it 
as is. As for breaking things and transitions, I think we need to be 
more careful and plan it well.





More information about the Pkg-javascript-devel mailing list