@reboost/plugin-babel
TypeScript icon, indicating that this package has built-in type declarations

0.21.0 • Public • Published

npm license

Babel Plugin

Adds support for transforming JavaScript or TypeScript with Babel.

Usage

Setup

Install it using npm

npm i -D @reboost/plugin-babel

Install @babel/core, if not already installed

npm i @babel/core

Import it from the package

const { start } = require('reboost');
const BabelPlugin = require('@reboost/plugin-babel');

Add it to the plugins array

const { start } = require('reboost');
const BabelPlugin = require('@reboost/plugin-babel');

start({
  plugins: [
    BabelPlugin({
      // Options
    })
  ]
})

Options

Supports all Babel options.

Example

Speeding up the build by excluding node modules

You may not need babel transformations on node_modules files. You can simply exclude them by using UsePlugin. This will increase performance too.

const { start, builtInPlugins: { UsePlugin } } = require('reboost');
const BabelPlugin = require('@reboost/plugin-babel');

start({
  plugins: [
    UsePlugin({
      include: /.*/,
      exclude: /node_modules/,
      use: BabelPlugin()
    })
  ]
})

Transforming new features

NOTE: While developing (not production) your app you should not transform your JavaScript code to support extremely old browsers, you should transform just the new features or proposals.

const { start, builtInPlugins: { UsePlugin } } = require('reboost');
const BabelPlugin = require('@reboost/plugin-babel');

start({
  plugins: [
    UsePlugin({
      include: /.*/,
      exclude: /node_modules/,
      use: BabelPlugin({
        plugins: [
          // Your babel plugin,
          // for example
          ['@babel/plugin-proposal-pipeline-operator', { proposal: 'smart' }]
        ]
      })
    })
  ]
})

License

Licensed under the MIT License.

Readme

Keywords

Package Sidebar

Install

npm i @reboost/plugin-babel

Weekly Downloads

1

Version

0.21.0

License

MIT

Unpacked Size

6.98 kB

Total Files

6

Last publish

Collaborators

  • sarsamurmu