How to use Babel 6 on NodeJS backend

Babel supports future versions of Javascript and compile it to currently supported versions of Javascript. Very similar to TypeScript.

To use Babel 6 on your project:

npm install babel-core --save-dev
npm install babel-preset-es2015 --save-dev

And then on your start file:


From this line all further requires are going to be compiled with Babel.

You also need to tell Babel what preset to use. On the root create a file `.babelrc` and configure like this:

    presets: [ "es2015" ]

Done. Now you can use es6 on your modules.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s