Does SailsJS support ES6?

Jaseem Abbas picture Jaseem Abbas · Oct 19, 2015 · Viewed 7.8k times · Source

Is there a way to get ES6 in sails.js?

Answer

Eugene Obrezkov picture Eugene Obrezkov · Oct 20, 2015

SailsJS is just a framework written via ES5 syntax and it doesn't need to support ES6.

You can write project with ES6 syntax as you usually do and use Babel\Traceur\whatever for running.

My flow is following:

  • Create Sails project;
  • Install babel as devDependencies;
  • Update npm start script in package.json with "start": "babel-node app.js";

That's it. I can write ES6\7 code in my controllers\models\etc and run the server via npm start command. It works as usual as you wrote it with ES5 syntax.

Babel Transpiler

Babel Node