Skip to content

plotnikovn/babel-preset-modern-browsers

 
 

Repository files navigation

babel-preset-modern-browsers NPM version

Edge 14 Firefox 51 Chrome 51 Opera 38 Safari 10

Babel presets for modern browsers

Dependency ci Status Dependency Status

Alternatives

Installation

npm install --save-dev babel-preset-modern-browsers

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"
  • fullSupport - Add support for features below
  • es2016 - 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.

Features supported only with full-support

  • default parameters: new Function() support
  • for...of: iterator closing
  • destructuring: iterator closing

More info in the compatibility table below

Compatibility Table

Feature Edge Firefox Chrome Opera Safari

ES2015

Syntax

default parameters, without temporal dead zone, separate scope and new Function() support Edge 14 Firefox 43 Chrome 49 Opera 36 Safari 10
default parameters, with temporal dead zone and separate scope Edge 14 Firefox 51 Chrome 49 Opera 36 Safari 10
default parameters, with new Function() support Edge 14 Firefox 53 Chrome 49 Opera 36 Safari 10
↳ (fullSupport) transform-es2015-parameters
rest parameters Edge 12 Firefox 43 Chrome 47 Opera 34 Safari 10
↳ (fullSupport) transform-es2015-parameters
spread Edge 13 Firefox 36 Chrome 46 Opera 33 Safari 10
↳ (unused) transform-es2015-spread
computed properties Edge 12 Firefox 34 Chrome 44 Opera 31 Safari 7.1
↳ (unused) transform-es2015-computed-properties
shorthand properties Edge 12 Firefox 33 Chrome 43 Opera 30 Safari 9
↳ (unused) transform-es2015-shorthand-properties
for...of, without iterator closing Edge 13 Firefox 36 Chrome 39 Opera 26 Safari 10
for...of, with iterator closing Edge 14 Firefox 53 Chrome 51 Opera 38 Safari 10
↳ (fullSupport) transform-es2015-for-of
template string Edge 13 Firefox 34 Chrome 41 Opera 28 Safari 9
↳ (unused) transform-es2015-template-literals
Regexp sticky Edge 13 Firefox 31 Chrome 49 Opera 36 Safari 10
↳ (unused) transform-es2015-sticky-regex
Regexp unicode Edge 12 Firefox 46 Chrome 51 Opera 38 Safari 10
↳ (unused) transform-es2015-unicode-regex
destructuring, without iterator closing, separate scope, new Function() support Edge 14 Firefox 47 Chrome 49 Opera 36 Safari 10
destructuring, with iterator closing, separate scope, new Function() support Edge 15 Firefox 53 Chrome 52 Opera 39 Safari 10
↳ (fullSupport) transform-es2015-destructuring
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
↳ (unused) transform-es2015-literals

Bindings

const Edge 14 Firefox 51 Chrome 49 Opera 36 Safari 10
let Edge 14 Firefox 51 Chrome 49 Opera 36 Safari 10
↳ (unused) transform-es2015-block-scoping
block-level function declaration Edge 11 Firefox 46 Chrome 41 Opera 28 Safari 10
↳ (unused) transform-es2015-block-scoped-functions

Functions

arrow functions Edge 13 Firefox 45 Chrome 49 Opera 36 Safari 10
↳ (used, needed with function-name) transform-es2015-arrow-functions
classes Edge 13 Firefox 45 Chrome 49 Opera 36 Safari 10
↳ (unused) transform-es2015-classes
super Edge 13 Firefox 45 Chrome 49 Opera 36 Safari 10
↳ (unused) transform-es2015-object-super
generators without yield *, iterator closing Edge 13 Firefox 45 Chrome 49 Opera 36 Safari 10
generators, yield *, iterator closing Edge 13 Firefox 53 Chrome 51 Opera 38 Safari 10
↳ (unused) transform-regenerator

Built-ins

typeof Symbol Edge 12 Firefox 36 Chrome 38 Opera 25 Safari 9
↳ (unused) transform-es2015-typeof-symbol

Built-in extensions

function name Edge Partial Firefox 53 Chrome 52 Opera 39 Safari 10
function name (babel support) Edge Partial Firefox 53 Chrome 52 Opera 39 Safari 10
↳ (used) transform-es2015-function-name

ES2016

exponentiation operator Edge 14 Firefox 52 Chrome 52 Opera 39 Safari 10
↳ (used) transform-exponentiation-operator

ES2017

trailing commas in function Edge 14 Firefox 52 Chrome 58 Opera 45 Safari 10
↳ (used) babel-plugin-syntax-trailing-function-commas
async function Edge 14 Firefox 52 Chrome 55 Opera 42 Safari 10
↳ (used) babel-plugin-transform-async-to-generator

Release Dates

Date Version
2017-06-13 Firefox 54
2017-04-18 Firefox 53
2017-03-07 Firefox 52
2017-01-24 Firefox 51
2016-12-13 50.0.1
2016-11-08 Firefox 50
2016-09-20 Firefox 49
2016-08-02 Firefox 48
2016-06-07 Firefox 47
Date Version
2017-06-06? Chrome 59
2017-04-25? Chrome 58
2017-03-14? Chrome 57
2017-01-25 Chrome 56
2016-12-06 Chrome 55
2016-10-12 Chrome 54
2016-08-31 Chrome 53
2016-07-20 Chrome 52

Thanks

About

Babel presets for modern browsers

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 57.8%
  • Shell 42.2%