Skip to content
This repository has been archived by the owner on May 11, 2018. It is now read-only.

Releases: babel/babel-preset-env

v1.0.0

09 Dec 20:52
Compare
Choose a tag to compare

v1.0.0 (2016-12-09)

🚀 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/electronToChromium.js, but @kevinsawicki says we could generate the data from atom-shell/dist/index.json as well! (Someone should make a PR 😄)

v0.0.9

24 Nov 20:58
Compare
Choose a tag to compare

v0.0.9 (2016-11-24)

🚀 New Feature

  • Support Opera (#48 (Henry Zhu)

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

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

v0.0.7

02 Nov 23:01
Compare
Choose a tag to compare

v0.0.7 (2016-11-02)

🚀 New Feature

  • Hardcode a current node version option (#35) (Henry Zhu)

This will detect the current node version being run and compile based on support

{
  "presets": [
    ["env", {
      "targets": {
        "node": "current" // parseFloat(process.versions.node)
      }
    }]
  ]
}
  • add 'whitelist' option (#31) (Henry Zhu)

If you're finding any issues you can add plugins similarly to "plugins": []

 {
  "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 Fixes

  • Change default behavior to act the same as babel-preset-latest (#33) (Henry Zhu)
{ "presets": ["env"] } // should act the same as babel-preset-latest
  • 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"
}

Internal

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