@mfjs/babel-preset-env
v1.1.1
Published
babel autoprefixer with mfjs enabled
Downloads
14
Readme
babel-preset-env-mfjs
Babel preset augmenting babel-preset-env to enable mfjs translations.
Install
$ npm install --save-dev babel-preset-env @mfjs/babel-preset-env
Usage
Via .babelrc
.babelrc
{
"presets": ["@mfjs/env"]
}
It supports the same arguments as babel-preset-env, e.g.
{
"presets": [
["env", {
"targets": {
"chrome": 52
}
}]
]
}
To specify mfjs options use "mfjs" field in the arguments object:
{
"presets": [
["env", {
"mfjs": {
"require": "@mfjs/generators"
}
}]
]
}
Via CLI
$ babel script.js --presets @mfjs/env
Via Node API
require("babel-core").transform("code", {
presets: ["@mfjs/env"]
});
Rationale
Why not separate preset without env
.
The current version of mfjs transpiler supports only full ES5
syntax with a few ES6 extensions. Making separate preset and
running it after env
will not work, because mfjs wants to
recognize the ES6 extensions it supports to generate better code.
For example for for-of
and ES6 imports. This preset also
automatically enables env extensions mfjs doesn't support even
if they are excluded in env
.
After mfjs implements the whole latest JS extensions it will be a separate preset or plugin.
LICENSE
Copyright © 2017 Vitaliy Akimov
Distributed under the terms of The MIT License (MIT).