Babel presets for modern browsers
This preset covers es2015
, es2016
, es2017
and es2018
.
More info in the compatibility table below
Since v12, this package requires @babel/[email protected]
. If you use babel 6, you can still use the version "11.0.1" of this package. If you want to migrate, you can read the announcement and the official migration guide.
- @babel/preset-env, especially
targets.esmodules
npm install --save-dev babel-preset-modern-browsers@next @babel/core
Add 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"es2018
- Enable es2018 features (Enabled by default)shippedProposals
- Enable features in stages but already available in browsers (Enabled by default)edge
- Support Edge (Enabled by default)
{
presets: [
["modern-browsers", { "loose": true }]
]
}
{
presets: [
[require("babel-preset-modern-browsers"), { "loose": true }]
]
}
Missing features added for edge
option:
- function-name
- object rest/spread properties
Note: most unused plugins are babel 6 plugins, I didn't update them for the documentation.
Date | Version | ESR |
---|---|---|
2018-12-11 | ||
2018-10-23 | ||
2018-09-05 | ||
2018-06-26 | ||
2018-05-09 | ESR | |
2018-03-13 | ||
2018-01-16 |
Date | Version |
---|---|
2018-10-16 | |
2018-09-04 | |
2018-07-24 | |
2018-05-29 | |
2018-04-17 | |
2018-03-06 | |
2018-01-23 |
Date | Version |
---|---|
2018-03-29 | |
2017-09-19 | |
2017-03-27 | |
2016-09-20 |
Date | Version |
---|---|
2018-04-30 | |
2017-09-26 | |
2017-03-20 |
- Inspired by https://github.com/askmatey/babel-preset-modern