Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/crystal-ball/babel-base

đź”® Projects - Babel configs
https://github.com/crystal-ball/babel-base

babel crystal-ball

Last synced: about 2 months ago
JSON representation

đź”® Projects - Babel configs

Awesome Lists containing this project

README

        



babel base



Package version


NPM downloads


Build status


Known vulnerabilities


Test coverage


Maintainability

:status      




Renovate


Commitizen friendly


ZenHub


Semantic Release


Contributor Covenant

:integrations




Contains magic


Full of love

:flair       





This package generates a base Babel configuration and dependencies for
React applications and Node services. Users can customize the generated base
configurations to meet the specific needs of any project.




## ⚙️ Setup

**1. Install**

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

**2. Setup a Babel config**

```javascript
// 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**

```sh
# 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**

```javascript
// 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'
```