Babel presets for modern browsers
npm install --save-dev babel-preset-modern-browsersAdd the following line to your .babelrc file:
{
"presets": ["modern-browsers"]
}loose: 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 "commonjs"fullSupport- Add support for features belowes2016- Enable es2016 features (Enabled by default)es2017- Enable es2017 features (Enabled by default)
{
presets: [
["modern-browsers", { "loose": true }]
]
}{
presets: [
[require("babel-preset-modern-browsers").buildPreset, { "loose": true }]
]
}Note: to support async functions and other proposals, you can add babel preset stage-X or the stage you want:
{
"presets": [
["modern-browsers", { objectRest: true }],
"stage-1"
]
}This preset covers es2015, es2016 and es2017.
- default parameters: new Function() support
- for...of: iterator closing
- destructuring: iterator closing
More info in the compatibility table below
| Date | Version |
|---|---|
| 2017-06-13 | |
| 2017-04-18 | |
| 2017-03-07 | |
| 2017-01-24 | |
| 2016-12-13 | 50.0.1 |
| 2016-11-08 | |
| 2016-09-20 | |
| 2016-08-02 | |
| 2016-06-07 |
| Date | Version |
|---|---|
| 2017-06-06? | |
| 2017-04-25? | |
| 2017-03-14? | |
| 2017-01-25 | |
| 2016-12-06 | |
| 2016-10-12 | |
| 2016-08-31 | |
| 2016-07-20 |
- Inspired by https://github.com/askmatey/babel-preset-modern