Babel preset that uses modify-babel-preset to modify babel-preset-es2015-node4 and enable loose mode where available.
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.
.babelrc
{
"presets": ["es2015-node4-loose"]
}
$ babel script.js --presets es2015-node4-loose
require("babel-core").transform("code", {
presets: ["es2015-node4-loose"]
})
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.
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.