babel/experimental/babel-preset-env
Ville Immonen 77a6d686ba Build the browser data from ES compatibility table (#8)
Use the data from https://github.com/kangax/compat-table to build the
browser data.

Each Babel plugin is mapped to a list of features in the compatibility
table (in `data/pluginFeatures.js`), and the minimum supporting
version looked up from the compatibility test data. The script builds
the final browser data file in `data/plugins.json`.
2016-10-06 14:23:01 -04:00
..
2016-08-30 17:56:04 -04:00
2016-08-30 17:56:04 -04:00
2016-08-13 23:48:33 -04:00

[WIP 0.0.0] babel-preset-env npm travis

Babel preset for all envs.

Install

$ npm install --save-dev babel-preset-env

Usage via .babelrc

Options

We would like help to make the data is correct! This just means usage/testing!

  • 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 one of ["amd", "umd", "systemjs", "commonjs"]
{
  "presets": [
    ["env", {
      "targets": {
        "chrome": 52
      },
      "loose": true,
      "modules": false
    }]
  ]
}

Example

// src
export class A {}
// default is to run all transforms
{
  "presets": [
    ["env", {}]
  ]
}

// ...

var A = exports.A = function A() {
  _classCallCheck(this, A);
};
// target chrome 52
{
  "presets": [
    ["env", {
      "targets": {
        "chrome": 52
      }
    }]
  ]
}

// ...

class A {}
exports.A = A;
// target chrome 52 with webpack 2/rollup
{
  "presets": [
    ["env", {
      "targets": {
        "chrome": 52
      },
      "modules": false
    }]
  ]
}

// ...

export class A {}