babel-preset-r29

3.0.0 • Public • Published

babel-preset-r29

A Babel preset for Refinery29

Install

npm install --save-dev babel-preset-r29

Usage

Via .babelrc (Recommended)

.babelrc

{
  "presets": ["r29"]
}

or, with some of our supported options:

{
  "presets": [
    "r29", {
      "node": true
    }
  ]
}

Via CLI

$ babel script.js --presets r29

Via Node API

require("babel-core").transform("code", {
  presets: ["r29"]
});

Supported options

node

boolean, defaults to false.

Targets Node v6 instead of browsers. Useful for avoiding the inclusion of unnecessary things like the regenerator runtime in our server builds.

loose

boolean, defaults to false.

Turns on the ES2015 plugin's loose mode. http://2ality.com/2015/12/babel6-loose-mode.html

In practice we have found that this can reduce bundle size by ~5%.

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. Use this for Webpack >=2, since Webpack >=2's tree-shaking works best if you don't transform import/export statements.

Example of a Webpack config where this is the case:

{
  test: /\.js$/,
  use: {
    loader: 'babel-loader',
    options: {
      presets: [
        ['r29', { modules: false }],
      ],
      plugins: []
    }
  },
  exclude: /node_modules/
}

Package Sidebar

Install

npm i babel-preset-r29

Weekly Downloads

2

Version

3.0.0

License

MIT

Unpacked Size

3.79 kB

Total Files

4

Last publish

Collaborators

  • vice-devops
  • vice-services
  • taryn.miller
  • briankellyvice
  • johnpark
  • dugivice
  • tonnie_exelero
  • davidbonting
  • lukepate
  • geraldinas
  • jeffvazquez
  • refinery29
  • dmaziad