@travi/babel-preset

3.0.121 • Public • Published

babel-preset-travi

My shareable babel preset

Node CI Workflow Status

Table of Contents

Usage

npm MIT license

Installation

$ npm install @travi/babel-preset --save-dev

Via .babelrc for internal development purposes

This will target the current version of node and transpile my preferred upcoming features.

{
  "presets": ["@travi"]
}

In React projects

This will target the current node version, but will also transpile React features

{
  "presets": [["@travi", {"react": true}]]
}

Via Rollup

  • Prevent transpilation of module imports/exports so Rollup can optimize properly
  • Transpile to the lowest common denominator of your expected consumers' execution environments

In the rollup.config.js:

export default {
  ...
  plugins: [
    babel({
      babelrc: false,
      exclude: ['./node_modules/**'],
      presets: [['@travi', {targets: {node: 8}, modules: false}]],
    }),
    ...
  ],
  ...
};

In projects that target both node and browsers

export default {
  ...
  plugins: [
    babel({
      babelrc: false,
      exclude: ['./node_modules/**'],
      presets: [['@travi', {targets: {node: 8, browser: true}, modules: false}]],
    }),
    ...
  ],
  ...
};

In React projects

export default {
  ...
  plugins: [
    babel({
      babelrc: false,
      exclude: ['./node_modules/**'],
      presets: [['@travi', {
        targets: {node: 8, browser: true},
        react: true,
        modules: false
      }]],
    }),
    ...
  ],
  ...
};

Contribution

Conventional Commits Commitizen friendly semantic-release PRs Welcome Renovate

Dependencies

$ nvm install
$ npm install

Verification

$ npm test

Readme

Keywords

none

Package Sidebar

Install

npm i @travi/babel-preset

Weekly Downloads

698

Version

3.0.121

License

MIT

Unpacked Size

12 kB

Total Files

13

Last publish

Collaborators

  • travi