0.0.3 • Published 6 years ago

sails-hook-babelv7 v0.0.3

Weekly downloads
5
License
MIT
Repository
github
Last release
6 years ago

sails-hook-babelv7

npm version Dependency Status

Needs at least Sails version 0.11.0 to work

Sails JS hook to activate ES6/7 Javascript code for your whole sails app, via https://babeljs.io/.

Installation

npm install sails-hook-babel

Upgrading Babel

If you are migrating a project to Babel 7 the easiest approach is to run babel-upgrade. See their readme for instructions.

Usage

Just lift your app as normal, and enjoy the future of Javascript today. To see what is possible, see: https://babeljs.io/docs/en/

Configuration

By default, configuration lives in sails.config.babelv7. The configuration key (babel) can be changed by setting sails.config.hooks['sails-hook-babel'].configKey.

ParameterTypeDetails
compile((boolean))Whether or not sails should compile future JS code. Defaults to true.
polyfill((boolean))Whether or not use babel-polyfill. Defaults to false.
presets((array))Which presets to transpile your code with.

Defaults to:

["@babel/preset-env", 
    {
        "targets": { "node": "current" }
    }
]

Also you can use other Babel 7 options.

Thats it!