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

Package detail

@rtsao/babel-preset-env

babel3.6kMIT7.0.0-beta.31

A Babel preset for each environment.

readme

@babel/preset-env npm travis npm-downloads codecov

A Babel preset that compiles ES2015+ down to ES5 by automatically determining the Babel plugins and polyfills you need based on your targeted browser or runtime environments.

npm install @babel/preset-env --save-dev

Without any configuration options, @babel/preset-env behaves exactly the same as @babel/preset-latest (or @babel/preset-es2015, @babel/preset-es2016, and @babel/preset-es2017 together).

{
  "presets": ["@babel/env"]
}

You can also configure it to only include the polyfills and transforms needed for the browsers you support. Compiling only what's needed can make your bundles smaller and your life easier.

This example only includes the polyfills and code transforms needed for the last two versions of each browser, and versions of Safari greater than or equal to 7. We use browserslist to parse this information, so you can use any valid query format supported by browserslist.

{
  "presets": [
    ["@babel/env", {
      "targets": {
        "browsers": ["last 2 versions", "safari >= 7"]
      }
    }]
  ]
}

Similarly, if you're targeting Node.js instead of the browser, you can configure babel-preset-env to only include the polyfills and transforms necessary for a particular version:

{
  "presets": [
    ["@babel/env", {
      "targets": {
        "node": "6.10"
      }
    }]
  ]
}

For convenience, you can use "node": "current" to only include the necessary polyfills and transforms for the Node.js version that you use to run Babel:

{
  "presets": [
    ["@babel/env", {
      "targets": {
        "node": "current"
      }
    }]
  ]
}

How it Works

Determine environment support for ECMAScript features

Use external data such as compat-table to determine browser support. (We should create PRs there when necessary)

We can periodically run build-data.js which generates plugins.json.

Ref: #7

Maintain a mapping between JavaScript features and Babel plugins

Currently located at plugin-features.js.

This should be straightforward to do in most cases. There might be cases where plugins should be split up more or certain plugins aren't standalone enough (or impossible to do).

Support all plugins in Babel that are considered latest

Default behavior without options is the same as @babel/preset-latest.

It won't include stage-x plugins. env will support all plugins in what we consider the latest version of JavaScript (by matching what we do in @babel/preset-latest).

Ref: #14

Determine the lowest common denominator of plugins to be included in the preset

If you are targeting IE 8 and Chrome 55 it will include all plugins required by IE 8 since you would need to support both still.

Support a target option "node": "current" to compile for the currently running node version.

For example, if you are building on Node 6, arrow functions won't be converted, but they will if you build on Node 0.12.

Support a browsers option like autoprefixer.

Use browserslist to declare supported environments by performing queries like > 1%, last 2 versions.

Ref: #19

Browserslist support.

Browserslist is a library used to share a supported list of browsers between different front-end tools like autoprefixer, stylelint, eslint-plugin-compat and many others.

By default, @babel/preset-env will use browserslist config sources.

For example, to enable only the polyfills and plugins needed for a project targeting last 2 versions and IE10:

.babelrc

{
  "presets": [
    ["@babel/env", {
      "useBuiltIns": "entry"
    }]
  ]
}

browserslist

Last 2 versions
IE 10

or

package.json

"browserslist": "last 2 versions, ie 10"

Browserslist config will be ignored if: 1) targets.browsers was specified 2) or with ignoreBrowserslistConfig: true option (see more):

Targets merging.

  1. If targets.browsers is defined - the browserslist config will be ignored. The browsers specified in targets will be merged with any other explicitly defined targets. If merged, targets defined explicitly will override the same targets received from targets.browsers.

  2. If targets.browsers is not defined - the program will search browserslist file or package.json with browserslist field. The search will start from the working directory of the process or from the path specified by the configPath option, and go up to the system root. If both a browserslist file and configuration inside a package.json are found, an exception will be thrown.

  3. If a browserslist config was found and other targets are defined (but not targets.browsers), the targets will be merged in the same way as targets defined explicitly with targets.browsers.

Install

With npm:

npm install --save-dev @babel/preset-env

Or yarn:

yarn add @babel/preset-env --dev

Usage

The default behavior without options runs all transforms (behaves the same as @babel/preset-latest).

{
  "presets": ["@babel/env"]
}

Options

For more information on setting options for a preset, refer to the plugin/preset options documentation.

targets

{ [string]: number | string }, defaults to {}.

Takes an object of environment versions to support.

Each target environment takes a number or a string (we recommend using a string when specifying minor versions like node: "6.10").

Example environments: chrome, opera, edge, firefox, safari, ie, ios, android, node, electron.

The data for this is generated by running the build-data script which pulls in data from compat-table.

targets.ecmascript

"5" | "2015" | "2016" | "2017" | "2018"

The minimum ECMAScript version you want to target.

targets.node

number | string | "current" | true

If you want to compile against the current node version, you can specify "node": true or "node": "current", which would be the same as "node": process.versions.node.

targets.browsers

Array<string> | string

A query to select browsers (ex: last 2 versions, > 5%) using browserslist.

Note, browsers' results are overridden by explicit items from targets.

spec

boolean, defaults to false.

Enable more spec compliant, but potentially slower, transformations for any plugins in this preset that support them.

loose

boolean, defaults to false.

Enable "loose" transformations for any plugins in this preset that allow them.

modules

"amd" | "umd" | "systemjs" | "commonjs" | false, defaults to "commonjs".

Enable transformation of ES6 module syntax to another module type.

Setting this to false will not transform modules.

debug

boolean, defaults to false.

Outputs the targets/plugins used and the version specified in plugin data version to console.log.

include

Array<string>, defaults to [].

An array of plugins to always include.

Valid options include any:

  • Babel plugins - both with (@babel/plugin-transform-spread) and without prefix (transform-spread) are supported.

  • Built-ins, such as map, set, or object.assign.

This option is useful if there is a bug in a native implementation, or a combination of a non-supported feature + a supported one doesn't work.

For example, Node 4 supports native classes but not spread. If super is used with a spread argument, then the transform-classes transform needs to be included, as it is not possible to transpile a spread with super otherwise.

NOTE: The include and exclude options only work with the plugins included with this preset; so, for example, including proposal-do-expressions or excluding proposal-function-bind will throw errors. To use a plugin not included with this preset, add them to your config directly.

exclude

Array<string>, defaults to [].

An array of plugins to always exclude/remove.

The possible options are the same as the include option.

This option is useful for "blacklisting" a transform like transform-regenerator if you don't use generators and don't want to include regeneratorRuntime (when using useBuiltIns) or for using another plugin like fast-async instead of Babel's async-to-gen.

useBuiltIns

"usage" | "entry" | false, defaults to false.

A way to apply @babel/preset-env for polyfills (via @babel/polyfill).

npm install @babel/polyfill --save

useBuiltIns: 'usage'

Adds specific imports for polyfills when they are used in each file. We take advantage of the fact that a bundler will load the same polyfill only once.

In

a.js

var a = new Promise();

b.js

var b = new Map();

Out (if environment doesn't support it)

import "core-js/modules/es6.promise";
var a = new Promise();
import "core-js/modules/es6.map";
var b = new Map();

Out (if environment supports it)

var a = new Promise();
var b = new Map();

useBuiltIns: 'entry'

NOTE: Only use require("@babel/polyfill"); once in your whole app. Multiple imports or requires of @babel/polyfill will throw an error since it can cause global collisions and other issues that are hard to trace. We recommend creating a single entry file that only contains the require statement.

This option enables a new plugin that replaces the statement import "@babel/polyfill" or require("@babel/polyfill") with individual requires for @babel/polyfill based on environment.

In

import "@babel/polyfill";

Out (different based on environment)

import "core-js/modules/es7.string.pad-start";
import "core-js/modules/es7.string.pad-end";

useBuiltIns: false

Don't add polyfills automatically per file, or transform import "@babel/polyfill" to individual polyfills.

forceAllTransforms

boolean, defaults to false.

<summary>Example</summary>

With Babel 7's .babelrc.js support, you can force all transforms to be run if env is set to production.

  module.exports = {
    presets: [
      ["@babel/env", {
        targets: {
          chrome: 59,
          edge: 13,
          firefox: 50,
        },
        // for uglifyjs...
        forceAllTransforms: process.env === "production"
      }],
    ],
  };

NOTE: targets.uglify is deprecated and will be removed in the next major in favor of this.

By default, this preset will run all the transforms needed for the targeted environment(s). Enable this option if you want to force running all transforms, which is useful if the output will be run through UglifyJS or an environment that only supports ES5.

NOTE: Uglify has a work-in-progress "Harmony" branch to address the lack of ES6 support, but it is not yet stable. You can follow its progress in UglifyJS2 issue #448. If you require an alternative minifier which does support ES6 syntax, we recommend using babel-minify.

configPath

string, defaults to process.cwd()

The starting point where the config search for browserslist will start, and ascend to the system root until found.

ignoreBrowserslistConfig

boolean, defaults to false

Toggles whether or not browserslist config sources are used, which includes searching for any browserslist files or referencing the browserslist key inside package.json. This is useful for projects that use a browserslist config for files that won't be compiled with Babel.

shippedProposals

boolean, defaults to false

Toggles enabling support for builtin/feature proposals that have shipped in browsers. If your target environments have native support for a feature proposal, its matching parser syntax plugin is enabled instead of performing any transform. Note that this does not enable the same transformations as @babel/preset-stage3, since proposals can continue to change before landing in browsers.

The following are currently supported:

Builtins

Features


Examples

Export with various targets

export class A {}

Target only Chrome 52

.babelrc

{
  "presets": [
    ["@babel/env", {
      "targets": {
        "chrome": 52
      }
    }]
  ]
}

Out

class A {}
exports.A = A;

Target Chrome 52 with webpack 2/rollup and loose mode

.babelrc

{
  "presets": [
    ["@babel/env", {
      "targets": {
        "chrome": 52
      },
      "modules": false,
      "loose": true
    }]
  ]
}

Out

export class A {}

Target specific browsers via browserslist

.babelrc

{
  "presets": [
    ["@babel/env", {
      "targets": {
        "chrome": 52,
        "browsers": ["last 2 versions", "safari 7"]
      }
    }]
  ]
}

Out

export var A = function A() {
  _classCallCheck(this, A);
};

Target latest node via node: true or node: "current"

.babelrc

{
  "presets": [
    ["@babel/env", {
      "targets": {
        "node": "current"
      }
    }]
  ]
}

Out

class A {}
exports.A = A;

Show debug output

.babelrc

{
  "presets": [
    ["@babel/env", {
      "targets": {
        "safari": 10
      },
      "modules": false,
      "useBuiltIns": "entry",
      "debug": true
    }]
  ]
}

stdout

Using targets:
{
  "safari": 10
}

Modules transform: false

Using plugins:
  transform-exponentiation-operator {}
  transform-async-to-generator {}

Using polyfills:
  es7.object.values {}
  es7.object.entries {}
  es7.object.get-own-property-descriptors {}
  web.timers {}
  web.immediate {}
  web.dom.iterable {}

Include and exclude specific plugins/built-ins

always include arrow functions, explicitly exclude generators

{
  "presets": [
    ["@babel/env", {
      "targets": {
        "browsers": ["last 2 versions", "safari >= 7"]
      },
      "include": ["@babel/transform-arrow-functions", "es6.map"],
      "exclude": ["@babel/transform-regenerator", "es6.set"]
    }]
  ]
}

Issues

If you get a SyntaxError: Unexpected token ... error when using the object-rest-spread transform then make sure the plugin has been updated to, at least, v6.19.0.

changelog

Changelog

v1.6.1 (2017-10-17)

:bug: Bug Fix

  • Update compat table to fix two small issues (#445) (@danez)

ES2015 destructuring is not fully supported in Edge 15 and the polyfill required again. es6.math.imul is supported on Android as of version 4.4

  • Add polyfills for ES6 static Object methods (#441) (@danez)

Functions such as Object.keys, Object.freeze, ... do already exist in ES5, but their behaviour changed in ES2015. babel-preset-env with builtIns: true now adds the core-js polyfills for this methods if the browser only supports the ES5 variant of the method (like IE11 for example)

  • Normalize module format of plugins/built-ins data (#376) (@rtsao)

v1.6.0 (2017-07-04)

:rocket: New Feature

  • Bump compat-table for node8 support (#363) (@existentialism)

We updated our mappings to support native trailing function commas and string paddings in Node.js 8+.

:bug: Bug Fix

  • Handle chromeandroid browserslist value (#367) (@yavorsky)

We added support for using browserslist's chromeandroid in targets.

:memo: Documentation

  • Tweak uglify option docs (#368) (@existentialism)

Thanks to @graingert and @pfiaux for pointing out some needed updates to the uglify-js-related docs.

v1.5.2 (2017-06-07)

:bug: Bug Fix

  • Ensure explicit targets always override browsers key targets (#346) (@existentialism)

browser targets should be overridden by explicit targets, and we inadvertently broke this when we landed string version support.

v1.5.1 (2017-05-22)

:bug: Bug Fix

  • Compile with loose mode (#322) (@existentialism)

v1.5.0 (2017-05-19)

:rocket: New Feature

  • Support target versions as strings (#321) (@existentialism)

We were originally waiting on 2.x for a breaking change, but since node v7.10 and other targets are causing some pain, we decided to land a backwards compatible version.

:house: Internal

  • Backport: use preset-env and remove flow-strip-types (#324) (@yavorsky)
  • Bump electron-to-chromium (#329) (@existentialism)
  • Tweak version mappings to match compat-table updates (#323) (@existentialism)
  • Bump browserslist (#319) (@existentialism)
  • Bump compat-table (#307) (@existentialism)
  • Add debug-fixtures and test/tmp to .eslintignore (#305) (@yavorsky)

v1.4.0 (2017-04-14)

:rocket: New Feature

  • Support spec option (#98) (@Kovensky)

Added an option to enable more spec compliant, but potentially slower, transformations for any plugins in this preset that support them.

  • Bump compat-table for Edge 15 support (#273) (@existentialism)

We updated our mappings so that you can get native support for async/await and other goodies when targeting Edge 15!

:bug: Bug Fix

  • Add Android browser to name map (#270) (@existentialism)

Fixed a bug that was ignoring Android targets in browserslist queries (for example: "Android >= 4").

:memo: Documentation

  • Clarify note about loading polyfills only once (#282) (@darahak)
  • Add a reminder about include/exclude options (#275) (@existentialism)

:house: Internal

  • Chore: reduce package size. (#281) (@evilebottnawi)
  • Remove deprecated comment (#271) (@yavorsky)

v1.3.3 (2017-04-07)

:bug: Bug Fix

  • Support electron version in a string format (#252) (@yavorsky)

Adding electron as a target was an inadvertent breaking change as it no longer allowed string versions. We added an exception for now, even though it is inconsistent with other versions. Just as a note, the upcoming version 2.x will allow both number and string versions.

  • Ensure const-check plugin order (#257) (@existentialism)

We now force the const-es2015-check plugin to run first (so that it can correctly report issues before they get transpiled away).

:rocket: New Feature

  • Allow use babel-plugin- prefix for include and exclude (#242) (@yavorsky)

The include and exclude options now allow both prefixed (babel-plugin-transform-es2015-spread) and prefix-less (transform-es2015-spread) plugin names.

:memo: Documentation

  • Note babel plugin prefix handling in include/exclude (#245) (@existentialism)
  • Fix README: debug option shows info in stdout. (#236) (@Gerhut)

:house: Internal

  • Add simple smoke-test (#240) (@existentialism)
  • Add prepublish script (@existentialism)

v1.3.2 (2017-03-30)

  • Fixed an issue with a broken publish

v1.3.1 (2017-03-30)

  • Fixed a regression with missing files due to .npmignore.

v1.3.0 (2017-03-30)

:bug: Bug Fix

  • Add check for ArrayBuffer[Symbol.species] (#233) (@existentialism)

We now properly check for Symbol.species support in ArrayBuffer and include the polyfill if necessary. This should, as a side effect, fix ArrayBuffer-related errors on IE9.

:nail_care: Polish

  • Fill data with electron as a target. (#229) (@yavorsky)

We've simplified things by adding electron as a target instead of doing a bunch of things at runtime. Electron targets should now also be displayed in the debug output.

  • separate default builtins for platforms (#226) (@restrry)

If you are targeting the node environment exclusively, the always-included web polyfills (like dom.iterable, and a few others) will now no longer be included.

:memo: Documentation

  • remove deprecated projects (#223) [skip ci] (@stevemao)

:house: Internal

  • npmignore: Add related to build data and codecov. (#216) (@yavorsky)

v1.2.2 (2017-03-14)

:bug: Bug Fix

  • Refactor browser data parsing to handle families (#208) (@existentialism)

When parsing plugin data, we weren't properly handling browser families. This caused transform-es2015-block-scoping and other plugins to be incorrectly added for Edge >= 12. (s/o to @mgol for the the report and review!)

  • Add typed array methods to built-ins features. (#198) (@yavorsky)

Fixes an issue where some TypedArray features were not being polyfilled properly. (s/o to @alippai for the report!)

:memo: Documentation

  • Fixed minor typo in readme (#199) (@bl4ckdu5t)
  • Add built-ins, better links, compat-table url, etc (#195) (@yavorsky)
  • Change CONTRIBUTING.md to use absolute paths (#194) (@aaronang)

:house: Internal

  • Bump plugins (#201) (@yavorsky)
  • Enable code coverage (#200) (@alxpy)
  • Increase mocha timeout to 10s (#202) (@yavorsky)

v1.2.1 (2017-03-06)

:bug: Bug Fix

  • Add transform-duplicate-keys mapping (#192) (@existentialism)

Our plugin data was missing a mapping for the transform-duplicate-keys plugin which caused it to never be included. (s/o to @Timer for the report!)

:memo: Documentation

  • Clarify reasons for the uglify option in README.md (#188) (@mikegreiling)

v1.2.0 (2017-03-03)

:rocket: New Feature

  • Add uglify as a target (#178) (@yavorsky)

Support for uglify as a target is now available! This will enable all plugins and, as a result, fully compiles your code to ES5. Note, that useBuiltIns will work as before, and only the polyfills that your other target(s) need will be included.

{
  "presets": [
    ["env", {
      "targets": {
        "chrome": 55,
        "uglify": true
      },
      "useBuiltIns": true,
      "modules": false
    }]
  ]
}

:bug: Bug Fix

  • Respect older versions in invert equals map (#180) (@danez)

Fixes a number of bugs that caused some incorrect and/or missing environment data when parsing compat-table.

v1.1.11 (2017-03-01)

This release primarily upgrades compat-table, which adds support for async on Node 7.6!

:bug: Bug Fix

  • Fix hasBeenWarned condition. (#175) (@yavorsky)

:memo: Documentation

  • Add yarn example. (#174) (@yavorsky)

:house: Internal

  • Bump compat-table (#177) (@existentialism)
  • Add electron version exception test (#176) (@existentialism)

v1.1.10 (2017-02-24)

:bug: Bug Fix

  • Drop use of lodash/intersection from checkDuplicateIncludeExcludes (#173) (@existentialism)

v1.1.9 (2017-02-24)

:bug: Bug Fix

  • Add tests for debug output (#156) (@existentialism)

Since we've (mostly @yavorsky) have fixed a number of bugs recently with the debug option output, we added the ability to assert stdout matches what we expect. Read the updated CONTRIBUTING.md for more info.

  • Fixes #143. Log correct targets. (#155) (@yavorsky)

This fixes a bug in the debug output where incorrect target(s) were being displayed for why a particular plugin/preset was being included.

Given targets:

{
  "firefox": 52,
  "node": 7.4
}

Before:

Using plugins:
  transform-es2015-destructuring {"node":6.5}
  transform-es2015-for-of {"node":6.5}
  transform-es2015-function-name {"node":6.5}
  transform-es2015-literals {"node":4}
  transform-exponentiation-operator {"firefox":52}
  syntax-trailing-function-commas {"firefox":52}

After:

Using plugins:
  transform-es2015-destructuring {"firefox":52}
  transform-es2015-for-of {"firefox":52}
  transform-es2015-function-name {"firefox":52}
  transform-es2015-literals {"firefox":52}
  transform-exponentiation-operator {"node":7.4}
  syntax-trailing-function-commas {"node":7.4}

:memo: Documentation

  • Fix compat-table link in contributing.md (@existentialism)
  • Update README examples to fix website (#151) (@existentialism)
  • Fix few typos (#146) (@existentialism)
  • Add configuration example to clarify debug: true (#138) (@yavorsky)
  • Fix CHANGELOG’s v1.1.8 updates typo. (#136) (@yavorsky)
  • README: Update debug: true example. (#138) (@yavorsky)

:house: Internal

  • update compat (#169) (@hzoo)
  • Use external Electron to Chromium library (#144) (@Kilian)
  • Update yarn lockfile (#152) (@existentialism)
  • Extract option normalization into independant file (#125) (@baer)
  • Update yarnfile (#145) (@baer)
  • devDeps: eslint-config-babel v5.0.0 (#139) (@kaicataldo)
  • Update compat-table, build data (#135) (@hzoo)

v1.1.8 (2017-01-10)

:bug: Bug Fix

  • Debug: Transformations before logs. (#128) (@yavorsky)

Makes sure that all transformations on targets (such as exclude/include) are run before logging out with the debug option. Fixes (#127).

:house: Internal

  • Remove unnecessary extension. (#131) (@roman-yakobnyuk)
  • Include yarn.lock and update CI. (#124) (@existentialism)

v1.1.7 (2017-01-09)

Had a publishing issue in the previous release.

v1.1.6 (2017-01-06)

:bug: Bug Fix

  • Explicitly resolve lowest browser version. (#121) (@brokenmass)
{
  "targets": {
    "browsers": ["ios >= 6"] // was resolving to {ios: 10} rather than {ios: 6}
  }
}

v1.1.5 (2017-01-04)

:bug: Bug Fix

  • Show error if target version is not a number. (#107) (@existentialism)
{
  "presets": [
    ["env", {
      "targets": {
        "chrome": "52", // will error since it's not a number,
        "chrome": 52 // correct!
      }
    }]
  ]
}
  • Fix targets for the debug option. (#109) (@yavorsky)

Now it prints the transformed targets/environments rather than the browsers query.

Using targets:
{
  "chrome": 53,
  "ie": 10,
  "node": 6
}

Modules transform: false

Using plugins:
  transform-es2015-arrow-functions {"chrome":47,"node":6}
  transform-es2015-block-scoped-functions {"chrome":41,"ie":11,"node":4}

Using polyfills:
  es6.typed.uint8-clamped-array {"chrome":5,"node":0.12}
  es6.map {"chrome":51,"node":6.5}

v1.1.4 (2016-12-16)

v1.1.2-v1.1.4

:bug: Bug Fix

The new exclude/include options weren't working correctly for built-ins. (#102).

Also fixes an issue with debug option.

v1.1.1 (2016-12-13)

:bug: Bug Fix

Regression with the previous release due to using Object.values (ES2017). This wasn't caught because we are using babel-register to run tests and includes polyfills so it didn't fail on CI even though we have Node 0.10 as an env. Looking into fixing this to prevent future issues.

v1.1.0 (2016-12-13)

:rocket: New Feature

  • Add exclude option, rename whitelist to include (#89) (@hzoo)

Example:

{
  "presets": [
    ["env", {
      "targets": {
        "browsers": ["last 2 versions", "safari >= 7"]
      },
      "include": ["transform-es2015-arrow-functions"],
      "exclude": [
        "transform-regenerator",
        "transform-async-to-generator",
        "map"
      ],
      "useBuiltIns": true
    }]
  ]
}

"exclude": ["transform-regenerator"] doesn't transform generators and removes regeneratorRuntime from being imported.

"exclude": ["transform-async-to-generator"] doesn't use the built-in async-to-gen transform so you can use something like fast-async.

"exclude": ["map"] doesn't include the Map polyfill if you know you aren't using it in your code (w/ useBuiltIns). (We will figure out a way to automatically do this #84).

If you pass a wrong plugin it will error: valid options for include/exclude are in /data/plugin-features.js and /data/built-in-features.js (without the es6.)

:house: Internal

  • Optimize result filtration. (#77) (@yavorsky)
  • Update eslint config to align with other babel projects (#79) (@baer)
  • Update pathnames to avoid uppercase (#80) (@baer)
  • Refactor build data for clarity/consistency (#81) (@baer)
  • Update linting rules to cover all js (#82) (@baer)
  • Cleanup lib before rebuilding (#87) (@baer)
  • Move linting dependency to be dev only (#88) (@baer)

:memo: Documentation

  • Fix typo (#78) (@rohmanhm)
  • Fix PR link in changelog. (#75) (@nhajidin)

v1.0.2 (2016-12-10)

:bug: Bug Fix

Was requiring the wrong module kinda of like in v1.0.1:

https://github.com/zloirock/core-js#ecmascript-6-symbol

-import "core-js/modules/es6.object.get-own-property-symbols";

The test is just a part of Symbol.

v1.0.1 (2016-12-10)

:bug: Bug Fix

We were outputting an invalid path for regenerator!

+import "regenerator-runtime/runtime";
-import "core-js/modules/regenerator-runtime/runtime"-

v1.0.0 (2016-12-09)

:rocket: New Feature

A way to apply babel-preset-env for polyfills (via "babel-polyfill"`).

This option will apply a new Babel plugin that replaces require("babel-polyfill") with the individual requires for babel-polyfill based on the target environments.

Install

npm install babel-polyfill --save

In

import "babel-polyfill"; // create an entry js file that contains this
// or
import "core-js";

Out (different based on environment)

// chrome 55
import "core-js/modules/es7.string.pad-start"; // haha left_pad
import "core-js/modules/es7.string.pad-end";
import "core-js/modules/web.timers";
import "core-js/modules/web.immediate";
import "core-js/modules/web.dom.iterable";

.babelrc Usage

{
  "presets": [
    ["env", {
      "targets": {
        "electron": 1.4
      },
      "modules": false, // webpack 2
      "useBuiltIns": true // new option
    }]
  ]
}

Also looking to make an easier integration point via Webpack with this method. Please reach out if you have ideas!


Electron is also an environment, so Paul went ahead and added support for this!

.babelrc Usage

{
  "presets": [ ["env", {"targets": { "electron": 1.4 }}]]
}

Currently we are manually updating the data in /data/electron-to-chromium.js, but @kevinsawicki says we could generate the data from atom-shell/dist/index.json as well! (Someone should make a PR :smile:)

v0.0.9 (2016-11-24)

:rocket: New Feature

  • Support Opera (#48) (Henry Zhu)

Was as simple as modifying the chrome version and subtracting 13! (so chrome 54 = opera 41)

{
  "presets": [
    ["env", {
      "targets": {
        "opera": 41
      }
    }]
  ]
}

v0.0.8 (2016-11-16)

:nail_care: Polish

  • Only print the debug info once (#46 (Henry Zhu)

When using the debug option it was printing the data for each file processed rather than once.

{
  "presets": [
    ["env", {
      "debug": true
    }]
  ]
}

v0.0.7 (2016-11-02)

:rocket: New Feature

  • hardcode a current node version option (#35) (Henry Zhu)
{
  "presets": [
    ["env", {
      "targets": {
        "node": "current" // parseFloat(process.versions.node)
      }
    }]
  ]
}
  • add 'whitelist' option (#31) (Henry Zhu)
 {
  "presets": [
    ["env", {
      "targets": {
        "chrome": 52
      },
      "whitelist": ["transform-es2015-arrow-functions"]
    }]
  ]
}
  • Add more aliases (Henry Zhu)
  • Update plugin data: firefox 52 supports async/await! (#29) (Henry Zhu)

:bug: Bug Fixes

  • Use compat-table equals option (#36) (Henry Zhu)

Compute and use compat-table equivalents

{
  "safari6": "phantom",
  "chrome44": "iojs",
  "chrome50": "node64",
  "chrome51": "node65",
  "chrome54": "node7",
  "chrome30": "android44",
  "chrome37": "android50",
  "chrome39": "android51",
  "safari7": "ios7",
  "safari71_8": "ios8",
  "safari9": "ios9",
  "safari10": "ios10",
  "chrome50": "node6"
}
  • Change default behavior to act the same as babel-preset-latest (#33) (Henry Zhu)
{ "presets": ["env"] } // should act the same as babel-preset-latest

Internal

  • Add fixture helper for tests (#28) (Henry Zhu)