/babel-preset-es2015-node4-loose

Babel preset for all es2015-node4 plugins, with loose mode enabled where available.

Primary LanguageJavaScriptMIT LicenseMIT

babel-preset-es2015-node4-loose

Babel preset that uses modify-babel-preset to modify babel-preset-es2015-node4 and enable loose mode where available.

npm version MIT licensed Travis Status

Install

Install both this preset, and the core 'babel-preset-es2015-node4' that it modifies:

$ npm install --save-dev babel-preset-es2015-node4-loose babel-preset-es2015-node4

Why do you need to install both? The idea is that babel-preset-es2015-node4-loose will always be up to date because it will always use the version of babel-preset-2015-node4 that you have installed. If you don't want to update to the latest Babel release - you don't have to. Just pin babel-preset-2015 to the version you need.

Usage

Via .babelrc (Recommended)

.babelrc

{
  "presets": ["es2015-node4-loose"]
}

Via CLI

$ babel script.js --presets es2015-node4-loose

Via Node API

require("babel-core").transform("code", {
  presets: ["es2015-node4-loose"]
})

Does not include regenerator!

babel-preset-es2015-node4 doesn't include regenerator as mentioned here.

If you need it you will have to npm install and include regenerator yourself:

{
    "presets": ["es2015-node4-loose"],
    "plugins": ["transform-regenerator"]
}

Note: Regenerator doesn't have a loose mode.

About

This project has been highly inspired by babel-preset-es2015-loose. It will probably become obsolete when Babel team will support passing options to presets.