• This repository has been archived on 19/Mar/2023
  • Stars
    star
    110
  • Rank 316,770 (Top 7 %)
  • Language
    JavaScript
  • License
    ISC License
  • Created almost 9 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Babel presets for modern browsers

babel-preset-modern-browsers

Babel presets for modern browsers

DEPRECATED

Use @babel/preset-env instead with configured browserslists:

package.json

{
  "browserslist": {
    "modern": [
      "defaults and supports es6-module"
    ]
  },
}

babel.config.json

{
-  "presets": ["modern-browsers"]
+  "presets": [["@babel/preset-env", {
+      "shippedProposals": true,
+      "bugfixes": true,
+      "browserslistEnv": "modern"
+    }]]
}

https://babeljs.io/docs/babel-preset-env

Legacy README

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/[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.

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

More Repositories

1

nightingale

Logger for browser and node, see [nightingale](packages/nightingale) to get started !
TypeScript
12
star
2

babel-preset-latest-node

babel preset latest for node 14 (Current), node 12 (Active LTS) node 10 (Maintenance LTS)
JavaScript
11
star
3

php-importer

Import and process files
PHP
9
star
4

check-package-dependencies

Check package dependencies for duplicates, peer dependencies satisfaction and more early
TypeScript
9
star
5

reviewflow

🚦 Open Source GitHub bot that improves PR flow from opening to merging.
TypeScript
8
star
6

gulp-ejs-precompiler

A plugin for gulp that precompiles ejs templates
JavaScript
6
star
7

babel-plugin-defines

Like defines for UglifyJS, this plugin will replace defined variables by their values
JavaScript
5
star
8

ng-inspect

Inspect angular scopes with right click
JavaScript
4
star
9

deep-freeze-es6

deep freeze, works with Map and Set
JavaScript
4
star
10

github-app-autoassign-pr-to-creator

A Github App that assign newly created PR to its creator
JavaScript
4
star
11

pob

library generator/tools/scripts
JavaScript
4
star
12

graceful-kill

gracefully kills a spawn process
TypeScript
3
star
13

babel-preset-optimizations

Babel preset for optimizations only babel-minify plugins
JavaScript
3
star
14

babel-plugin-jsx-code

Replace `<Code>` content to render code side by side with source string
JavaScript
3
star
15

dotfiles

My gitted configuration files
Shell
3
star
16

react-pure-stateless-component

Pure React stateless component
JavaScript
3
star
17

pobpack

Build projects with webpack.
TypeScript
3
star
18

springbokjs-daemon

Springbok Daemon, usable with Gulp and Grunt to restart your server on watch
TypeScript
3
star
19

dart-simple_oauth2_server

Dart
3
star
20

use-react-intl-formatters

react-intl formatted message hook with use memo
TypeScript
2
star
21

object-properties

Shortcuts to Object.defineProperty and Object.defineProperties
TypeScript
2
star
22

babel-plugin-styled-components-react-native-web

babel plugin for styled-components/native with react-native-web
JavaScript
2
star
23

springbokjs-stylus-sprites

Sprites for Stylus
JavaScript
2
star
24

eslint-config-pob

pob eslint configs
JavaScript
2
star
25

content-loaded

browser is ready !
JavaScript
2
star
26

springbok-vscode-theme

JavaScript
2
star
27

router-segments

Router with segments
TypeScript
2
star
28

babel-plugin-remove-dead-code

This plugin for babel 6 remove dead code
JavaScript
2
star
29

modern-browsers

Regexp of modern browsers
TypeScript
2
star
30

dart-compiler

Compile files in dart
Dart
2
star
31

SpringbokJS

Springbok Framework for NodeJS
JavaScript
2
star
32

typescript-exercises

typescript exercises
TypeScript
2
star
33

Springbok-Framework

Framework for PHP, Javascript, with SCSS
JavaScript
2
star
34

ppa

see https://launchpad.net/~christophe-hurpeau/+archive/ppa
Shell
1
star
35

rollup-config-external-dependencies

rollup config external dependencies
JavaScript
1
star
36

dart-preprocessor

Preprocessor for files in dart
Dart
1
star
37

babel-plugin-transform-name-export-default

Name default exported functions when they don't have a name with the file name
JavaScript
1
star
38

springbokjs-base

JavaScript
1
star
39

Springbok-Framework-Plugins

Plugins for Springbok Framework
PHP
1
star
40

yarn-update-lock

Shell
1
star
41

Springbok-Databases

PHP
1
star
42

e2e-testing

JavaScript
1
star
43

babel-preset-flow-tcomb

Babel preset for flow with tcomb runtime check
JavaScript
1
star
44

lint-file

Run lint-staged linters on a list of files
JavaScript
1
star
45

banner-content-loader

Banner content loader for webpack
Shell
1
star
46

alp

personal exploration and framework for node and browser
TypeScript
1
star
47

rollup-plugin-svgr

simple rollup plugin svgr without svgo or babel
JavaScript
1
star
48

pob-monorepo-test-repository

Shell
1
star
49

babel-preset-pob

JavaScript
1
star
50

pobpack-utils

Utils for building projects with webpack
JavaScript
1
star
51

springbokjs-utils

NodeJS and Browser Utils
JavaScript
1
star
52

babel-preset-jsdoc

Babel preset for latest jsdoc
JavaScript
1
star
53

less-plugin-property-order

Check the order of the properties
JavaScript
1
star
54

springbokjs-shim

JavaScript
1
star
55

limosa

Fast Router for both browser and server
JavaScript
1
star
56

babel-plugin-react-native

JavaScript
1
star
57

springbokjs-skeletons

JavaScript
1
star
58

pob-babel

Moved to https://github.com/christophehurpeau/pob
JavaScript
1
star
59

pob-test-repository

Pob test repo
Shell
1
star
60

react-error-html

react component to display errors with error-html
JavaScript
1
star
61

error-html

render error stack in html
JavaScript
1
star
62

ynnub

TypeScript
1
star
63

sourcemap-concat

Concat files and generate a concatened sourcemap
JavaScript
1
star
64

php-var-dump

html var dump with syntax highlighting
PHP
1
star