Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

babel-preset-modern-browsers

christophehurpeau2kISCdeprecated15.0.2

Use @babel/preset-env instead with configured browserslists 'defaults and supports es6-module'

Babel presets for modern browsers

babel, preset, modern, browser, browsers

readme

babel-preset-modern-browsers

Babel presets for modern browsers

This preset covers syntax of es2015, es2016, es2017, es2018, es2019 and es2020.

More info in the compatibility table below

babel 7

Since v12, this package requires @babel/core@7.0.0. 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.

Alternatives

If you don't need preset-env, using this package will only install a few dependencies.

Modern browsers

Edge 83 Firefox 78 Chrome 80 Opera 67 Safari 13.1

Installation

npm install --save-dev babel-preset-modern-browsers @babel/core

Usage

Add the following line to your .babelrc file:

{
  "presets": ["modern-browsers"]
}

Options

  • 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"
  • shippedProposals - Enable features in stages but already available in browsers (Enabled by default)
{
  presets: [['modern-browsers', { loose: true }]];
}
{
  presets: [[require('babel-preset-modern-browsers'), { loose: true }]];
}

Browserlist

Edge >= 83, Firefox >= 78, FirefoxAndroid  >= 78, Chrome >= 80, ChromeAndroid >= 80, Opera >= 67, OperaMobile >= 67, Safari >= 13.1, iOS >= 13.4

Compatibility Table

Feature Edge Firefox Chrome Opera Safari

Shipped Proposals

| |
Numeric Separators Edge 79 Firefox 70 Chrome 75 Opera 62 Safari 13
syntax-numeric-separator | |

ES2020

| |
Optional chaining (?.) Edge 80 Firefox 74 Chrome 80 Opera 67 Safari 13.1
Nullish Coalescing operator (??) Edge 80 Firefox 72 Chrome 80 Opera 67 Safari 13.1

ES2019

| |
Optional catch binding Edge 79 Firefox 58 Chrome 66 Opera 53 Safari 11.1
JSON strings Edge 79 Firefox 62 Chrome 66 Opera 53 Safari 12

ES2018

| |
Object Rest/Spread Properties Edge 79 Firefox 55 Chrome 60 Opera 47 Safari 11.1
RegExp Unicode Property Escapes Edge 79 Firefox 78 Chrome 64 Opera 51 Safari 11.1
Asynchronous Iterators Edge 79 Firefox 57 Chrome 63 Opera 50 Safari 12

ES2017

| |
trailing commas in function Edge 14 Firefox 52 Chrome 58 Opera 45 Safari 10
async function Edge 15 Firefox 52 Chrome 55 Opera 42 Safari 10.1

ES2016

| |
exponentiation operator Edge 14 Firefox 52 Chrome 52 Opera 39 Safari 10

ES2015

Edge 79 Firefox 53 Chrome 52 Opera 39 Safari 10

Syntax

| |
default parameters Edge 14 Firefox 53 Chrome 49 Opera 36 Safari 10
rest parameters Edge 12 Firefox 43 Chrome 47 Opera 34 Safari 10
spread Edge 13 Firefox 36 Chrome 46 Opera 33 Safari 10
computed properties Edge 12 Firefox 34 Chrome 44 Opera 31 Safari 7.1
shorthand properties Edge 12 Firefox 33 Chrome 43 Opera 30 Safari 9
for...of Edge 14 Firefox 53 Chrome 51 Opera 38 Safari 10
template string Edge 13 Firefox 34 Chrome 41 Opera 28 Safari 9
Regexp sticky Edge 13 Firefox 31 Chrome 49 Opera 36 Safari 10
Regexp unicode Edge 12 Firefox 46 Chrome 51 Opera 38 Safari 10
destructuring Edge 15 Firefox 53 Chrome 52 Opera 39 Safari 10
Unicode Strings Edge 12 Firefox 45 Chrome 44 Opera 31 Safari 9
Octal/Binary Numbers Edge 12 Firefox 36 Chrome 41 Opera 28 Safari 9

Bindings

| |
const Edge 14 Firefox 51 Chrome 49 Opera 36 Safari 10
let Edge 14 Firefox 51 Chrome 49 Opera 36 Safari 10
block-level function declaration Edge 11 Firefox 46 Chrome 41 Opera 28 Safari 10

Functions

| |
arrow functions Edge 13 Firefox 45 Chrome 49 Opera 36 Safari 10
classes Edge 13 Firefox 45 Chrome 49 Opera 36 Safari 10
super Edge 13 Firefox 45 Chrome 49 Opera 36 Safari 10
generators Edge 13 Firefox 53 Chrome 51 Opera 38 Safari 10

Built-ins

| |
typeof Symbol Edge 12 Firefox 36 Chrome 38 Opera 25 Safari 9

Built-in extensions

| |
function name Edge 79 Firefox 53 Chrome 52 Opera 39 Safari 10

Partially Shipped Proposals (Not included)

Feature Edge Firefox Chrome Opera Safari
Static & Instance Class Fields Edge 79 Firefox None Chrome 74 Opera 61 Safari None
proposal-class-properties | |
Private Class Methods Edge 84 Firefox None Chrome 84 Opera 71 Safari None
proposal-private-methods | |

Release Dates

Thanks

changelog

Changelog

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

15.0.2 (2020-09-19)

15.0.0 (2020-09-19)

Support new Edge browser, updated babel plugins. Modern browsers are now: Edge >= 83, Firefox >= 78, Chrome >= 80, Opera >= 67, Safari >= 13.1, iOS >= 13.4

14.1.1 (2019-12-14)

Bug Fixes

  • require default in both added plugins (b75a8a7)

14.1.0 (2019-12-13)

Features

  • add optional chaining and nullish coalescing operator (df79b4b)

14.0.0 (2019-04-05)

Features

  • es2019 and json strings (78345b2)

BREAKING CHANGES

  • when edge: false, requires firefox 62 and safari 12

13.1.0 (2019-03-09)

Bug Fixes

  • asynchronous Iterators safari 12 (e5f4ff8)

Features

13.0.1 (2018-11-24)

13.0.0 (2018-11-24)

Features

  • add supportVariablesFunctionName (5064f23)
  • pass optional catch binding in modern browsers (c9b6af5)

BREAKING CHANGES

  • when edge:false, modern browsers are now: firefox 58, chrome 66, opera 53, safari 11.1

12.0.0 (2018-08-28)

12.0.0-beta.1 (2018-04-27)

chore

BREAKING CHANGES

  • drop node 4

12.0.0-beta.0 (2018-04-06)

Features

  • babel 7 and shipped proposals (1dda800)

11.0.1 (2018-04-06)

11.0.0 (2018-04-06)

Code Refactoring

  • remove buildPreset compatibility (9a7b01e)

Features

  • option es2018, remove option esnext and safari 10 (e5836f5)

BREAKING CHANGES

  • removed buildPreset
  • option esnext and safari 10 removed

10.0.1 (2017-10-22)

10.0.0 (2017-08-15)

Features

  • add dynamic import syntax (d0e7a7e)
  • add object rest/spread (d3c695f)
  • enable edge and safari10 by default (c3212e7)
  • firefox 53, safari 10.1 and edge 15 (b66b6cd)

9.0.2 (2017-03-09)

9.0.1 (2017-03-09)

Bug Fixes

  • reenable transform-async-to-generator (7b26e8f)

9.0.0 (2017-03-08)

Features

  • async functions and exponentiation operator (1f1682e)

BREAKING CHANGES

  • drop support firefox < 42, chrome < 55, opera < 42, safari < 10.1, option safari10

8.1.2 (2017-03-03)

8.1.1 (2017-02-27)

Bug Fixes

8.1.0 (2017-02-25)

Features

  • add es2017 plugins and es2016, es2017 option (ade31a8)

8.0.0 (2017-01-24)

7.0.0 (2016-11-17)

6.0.0 (2016-10-10)

5.1.0 (2016-08-01)

5.0.2 (2016-06-27)

5.0.0 (2016-06-27)

4.1.0 (2016-06-23)

3.0.0 (2016-06-11)

2.1.1 (2016-06-03)

2.1.0 (2016-05-26)

2.0.1 (2016-05-20)

2.0.0 (2016-04-26)