@epublishing/babel-preset-epublishing

0.1.8 • Public • Published

babel-preset-epublishing

This module is a preset for Babel, which bundles all of the plugins and presets necessary to build ePublishing front-end assets.

Installation

npm install [--save|--save-dev] babel-preset-epublishing

Usage

In .babelrc:

{
  "presets": [ "epublishing" ]
}

As a JS object in Grunt config:

{
  babel: {
    options: {
      presets: [ 'epublishing' ],
    },
  },
}

With Webpack v2 via babel-loader:

{
  module: {
    rules: [
      {
        test: /\.jsx?$/,
        exclude: /(node_modules|bower_components)/,
        loader: 'babel-loader',
        options: {
          presets: [ 'epublishing' ],
        },
      },
    ],
  },
}

Configuration

Custom options can be passed to this preset in the usual way:

{
  "presets": [
    ["epublishing", {
      "env": {
        "modules": "amd"
      }
    }]
  ]
}

Default Configuration Object

If an options object is passed to the preset, it is merged with ePublishing's default configuration, and the resulting values are passed down to individual presets and plugins.

{
  env: {
    modules: 'umd',
    targets: {
      browsers: [ 'last 3 versions', 'ie 11' ],
      uglify: true
    }
  },
  lodash: {
    // It's possible to override the option below, but it's usually set
    // dynamically by grunt-jade at compile time:
    cwd: undefined
  },
  transformRuntime: true, // set to false to disable babel-plugin-transform-runtime
}

babel-preset-env accepts many additional options that we don't currently use. See the babel-preset-env docs to find out what's available.

Readme

Keywords

Package Sidebar

Install

npm i @epublishing/babel-preset-epublishing

Weekly Downloads

69

Version

0.1.8

License

MIT

Unpacked Size

4.29 kB

Total Files

4

Last publish

Collaborators

  • mikedamage
  • brewern
  • mhedges1
  • niyati.ace
  • mhedges