# @nake/babel-preset

> Babel preset for transforming your future JS/JSX and TypeScript code

This babel preset is extended from [preset-env](https://babeljs.io/docs/en/babel-preset-env), [preset-react](https://babeljs.io/docs/en/babel-preset-react) and [preset-typescript](https://babeljs.io/docs/en/babel-preset-typescript), you can enable parts of them with simple opitons. This babel preset enabled almost all [TC39 experimental proposals](https://babeljs.io/docs/en/plugins#experimental) by default, you can disable them as you need.

## Features

- Reasonable default options
- Confiurable for various scenarios
- Auto polyfilled based on browserslist and node version
- Support experimental ES proposals out of box
- Support react and typescript out of box
- React compile-time code optimization
- Works great with [@nake/eslint-config](https://github.com/nakeapp/eslint-config)

## Installation

```bash
# Install with npx
$ npx install-peerdeps --dev @nake/babel-preset

# Install with yarn
$ yarn add --dev @babel/core @nake/babel-preset
```

_Use npx to install peerdeps automatically or install peerDependencies with npm/yarn manually._

## Usage

### Default

Default preset support React and all TC39 experimental proposals.

```js
// babel.config.js
module.exports = {
  presets: ['@nake/babel-preset'],
};
```

### TypeScript

Preset support both React and TypeScript.

```js
// babel.config.js
module.exports = {
  presets: [['@nake/babel-preset', { typescript: true }]],
};
```

You should change default extensions from `.js` to `.ts`, below is a babel CLI example.

```json
{
  "scripts": {
    "start": "NODE_ENV=development babel src --extensions .ts --watch --out-dir dist",
    "build": "NODE_ENV=production babel src --extensions .ts --out-dir dist"
  }
}
```

### To be continue

under construction...

## License

MIT
