Package Exports
- babel-preset-env
- babel-preset-env/data/plugins
- babel-preset-env/data/plugins.json
- babel-preset-env/package.json
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (babel-preset-env) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
babel-preset-env

Babel preset for all envs.
Install
$ npm install --save-dev babel-preset-env
Usage via .babelrc
Options
targets
- an object of browsers/environment versions to support (ex: chrome, node, etc).
The data for this is currently at: /data/plugins.json and being generated by /scripts/build-data.js using https://kangax.github.io/compat-table.
We would like help to make the data is correct! This just means usage/testing!
Currently: "chrome, edge, firefox, safari, node"
Some node features are >
6.5
loose
(boolean) - Enable "loose" transformations for any plugins in this preset that allow them (Disabled by default).modules
- Enable transformation of ES6 module syntax to another module type (Enabled by default to"commonjs"
).- Can be
false
to not transform modules, or one of["amd", "umd", "systemjs", "commonjs"]
- Can be
debug
(boolean) -console.log
out the targets and plugins being used as well as the version specified in/data/plugins.json
{
"presets": [
["env", {
"targets": {
"chrome": 52
},
"loose": true,
"modules": false
}]
]
}
Example
// src
export class A {}
// default is to run all transforms
{
"presets": [
["env", {}]
]
}
// ...
var A = exports.A = function A() {
_classCallCheck(this, A);
};
// target chrome 52
{
"presets": [
["env", {
"targets": {
"chrome": 52
}
}]
]
}
// ...
class A {}
exports.A = A;
// target chrome 52 with webpack 2/rollup
{
"presets": [
["env", {
"targets": {
"chrome": 52
},
"modules": false
}]
]
}
// ...
export class A {}
Example with debug: true
Using targets: {
"node": 6.5
}
Using plugins:
module: false
transform-exponentiation-operator {}
transform-async-to-generator {}
syntax-trailing-function-commas {}