4.0.0 • Published 3 years ago

@crystal-ball/babel-base v4.0.0

Weekly downloads
67
License
ISC
Repository
github
Last release
3 years ago

⚙️ Setup

1. Install

npm i @crystal-ball/babel-base -DE
npm i @babel/runtime -E

2. Setup a Babel config

// babel.config.js
'use strict'

const { babelBase } = require('@crystal-ball/babel-base')

module.exports = function babelConfigs() {
  // Generate base Babel configs for your target project type
  const baseConfigs = babelBase({
    env: 'development|production|test',
    target: 'node|react',
  })

  /* Optionally override the base configs as needed... */

  return baseConfigs
}

React projects

1. Install packages

# Install polyfills included in application bundle
npm i core-js regenerator-runtime -E

# Install Linaria preset as a dev dependency
npm i @linaria/babel-preset react-refresh -DE

2. Import polyfills

// src/index.js
/**
 * Polyfill environments, these imports will be transformed to just the
 * polyfills needed to meet the browserslist targets by the `entry` config for
 * `@babel/preset-env`
 */
import 'core-js'
import 'regenerator-runtime/runtime'