Does uglify-js support es6 and above?

4.6k Views Asked by At

I am watching this video : https://www.youtube.com/watch?v=kHifDVw5t_w . And in this video it is mentioned that uglify-js does not support es6 and above version of js. But when I try to minify js code(Es6 and above) with the help of uglify-js, it is perfectly minify the js file and did not throw any error.

1

There are 1 best solutions below

2
On

You should rely on official documentation instead of random YouTube videos:

Note:

  • uglify-js supports JavaScript and most language features in ECMAScript.
  • For more exotic parts of ECMAScript, process your source file with transpilers like Babel before passing onto uglify-js.
  • uglify-js@3 has a simplified API and CLI that is not backwards compatible with uglify-js@2.

You should be fine unless you are using features such as optional chaining that were only recently added to the standard, in which case the module authors simply haven't had enough time to add support.