0.1.0 • Published 10 years ago

webpack-babel-external-helpers v0.1.0

Weekly downloads
20
License
MIT
Repository
github
Last release
10 years ago

Webpack Babel External Helpers

Generates Babel 6's external helpers, then adds them to the Webpack compilation unit.

Pre-alpha!

This plugin has not yet been written to handle a variety of webpack configs. See the issues list and the usage example for more information.

##Usage Installation:

npm install --save-dev webpack-babel-external-helpers

Example webpack.config.js:

const BabelExternalHelpers = require("webpack-babel-external-helpers")

// instantiate the plugin
// in the current version, the parameter MUST be "*"
const helpersPlugin = new BabelExternalHelpers("*")

// configure babel-loader
const babelLoader = {
  test: /\.jsx?$/,
  exclude: /node_modules/,
  
  // in the current version, babel-loader options MUST be specified as a query string
  // in the current version, babel-loader CANNOT have any plugins configured
  loader: "babel?presets=es2015",
}

module.exports = {
  // in the current version, entry MUST be an array of strings
  entry: ["./main.js"],
  
  // in the current version, babel must be the FIRST loader
  module: {
    loaders: [babelLoader]
  },
  
  // finally, adds the plugin to webpack config
  plugins: [helpersPlugin],
}