Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using ECMAScript 6 on WebStorm without installing Babel

I enabled ECMAScript 6 on WebStorm so that I do not get IDE errors when using arrow functions.

However, I did not install Babel. I was prompted to install Babel after enabling ECMAScript 6. I had problems installing Babel.

Is it necessary to use Babel together with ECMAScript 6? What would be the side effect of enabling ECMAScript 6 without installing Babel?

I am using node.js on WebStorm.

like image 338
guagay_wk Avatar asked Jul 28 '26 10:07

guagay_wk


1 Answers

The purposes of Babel is to convert es6 code into es5 code BECAUSE most browsers do not FULLY support es6 yet, although are getting closer.

https://kangax.github.io/compat-table/es6/

You will see that IE11 support is poor whilst Firefox and Chrome almost have full support.

However, given that the latest Node fully understands ES6 there is now no need for Babel when using Node only unless of course you need to support older versions of Node which only understand ES5.

PS: if you enable Babel support in Webstorm it can generate ES5 files on the fly for you as you code in ES6. Alternatively, you can use a task runner such as Grunt or Gulp to do this for you. Depends if you need it!

like image 58
danday74 Avatar answered Jul 30 '26 00:07

danday74



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!