0.0.3-develop • Published 7 years ago

kn-babel v0.0.3-develop

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

kn-babel

Ready-to-go no-muss Babel configuration.

Usage

npm install --save-dev kn-babel

Node module hook

This method is useful when you want to use Babel for development but don't want to wait for your code to compile. Typically only used in development or for "toy" packages, as there's a small (but noticeable) performance hit.

// index.js
require('kn-babel').register();
require('./some-file-that-needs-babel');

Generating a configuration

This method is useful when you need to generate Babel options to pass to a build tool such as Rollup or Webpack.

// rollup.config.js
import createBabelConfig from 'kn-babel';
import babel from 'rollup-plugin-babel';

export default {
  entry: 'main.js',
  dest: 'bundle.js',
  format: 'cjs',
  plugins: [
    babel(createBabelConfig({runtime: 'browser', modules: false})),
  ],
};

Options

createBabelConfig() accepts an object with the following properties, all of which are optional: