Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/crystal-ball/babel-base
- Owner: crystal-ball
- License: isc
- Created: 2020-02-19T15:49:58.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-08-26T20:36:56.000Z (over 1 year ago)
- Last Synced: 2024-08-09T03:15:55.414Z (5 months ago)
- Topics: babel, crystal-ball
- Language: TypeScript
- Size: 631 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
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'
```