I'm relatively new to ES6+ (called modern JavaScript) but it seems if I want to use it in browsers I need babel-minify or terser. (First I thought Babili is another player but it's just the old name of Babel-Minify)
About polyfills for the browser there are production ready solutions like @babel/polyfill or Polyfill.io and with them it can be achieved to send smaller + faster code to modern browsers because they need no/few polyfills (test the browser quickly, load the needed polyfills dynamically and then start our app's main script). So it seems absolutely reasonable to use these modern technologies.
Here comes my dilemma about choosing babel-minify
or terser
.
The Webpack team decided to switch to terser
in upcoming Webpack 5.
The Babel team made a comparison table showing terser
is much better in speed.
The docs says that terser
is a fork of uglify-es
which was widely used before.
These makes me think that I have to choose terser
.
But on the other hand, Babel is still needed for transforming (and can be used for many useful things). They are in the business a long time ago (although Babili/babel-minify
was first released on August 26, 2016, so uglify
is older). They have a great developer community on GitHub, bugs may have discovered and fixed sooner. Based on these I feel more trust to them when it comes to production safe output. But I haven't found any article showing the pro's of babel-minify
over terser
.
Questions:
I would go with terser
because it seems promising and the reasons written above, but:
- What are the cases when I should use
babel-minify
overterser
? - Does it have any advantages of doing all the things with Babel packages?