Exploring ES6+ (modern JavaScript) is a new adventure for me, and I've discovered that in order to use it in browsers, tools like babel-minify or terser are necessary. It's interesting to note that Babili was initially thought to be a separate tool but is actually just the old name of Babel-Minify.
When it comes to browser polyfills, options such as @babel/polyfill and Polyfill.io offer efficient solutions for sending compact and swift code to modern browsers, minimizing the need for additional polyfills. The approach involves quickly testing the browser, dynamically loading necessary polyfills, and then running our main script. This makes employing these contemporary technologies highly practical.
My current predicament revolves around selecting either babel-minify
or terser
.
The decision by the Webpack team to transition to terser
in the forthcoming Webpack 5 holds weight.
According to a comparison table shared by the Babel team, terser
demonstrates superior speed.
Additionally, documentation suggests that terser
is an offshoot of uglify-es
, which enjoyed widespread adoption previously.
All signs seem to point towards choosing terser
.
However, it's worth acknowledging that Babel continues to play a crucial role in transformation processes and offers a range of beneficial functionalities. With a longstanding presence in the field (despite Babili/babel-minify
being initially released on August 26, 2016, making uglify
the older option), Babel boasts a robust developer community on GitHub that ensures prompt bug detection and resolution. These factors instill more confidence in their ability to deliver production-ready outputs. Nevertheless, I have yet to come across any literature highlighting the advantages of babel-minify
over terser
.
Questions:
While my inclination leans towards terser
due to its promising nature and aforementioned reasons, I still ponder:
- In what scenarios would opting for
babel-minify
instead ofterser
be favorable? - Are there any distinct benefits to utilizing all functionalities through Babel packages?