@nake/babel-preset
Version:
Babel preset for transforming your future JS/JSX and TypeScript code
71 lines (49 loc) • 1.84 kB
Markdown
> 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.
- 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)
```bash
$ npx install-peerdeps --dev @nake/babel-preset
$ yarn add --dev @babel/core @nake/babel-preset
```
_Use npx to install peerdeps automatically or install peerDependencies with npm/yarn manually._
Default preset support React and all TC39 experimental proposals.
```js
// babel.config.js
module.exports = {
presets: ['@nake/babel-preset'],
};
```
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"
}
}
```
under construction...
MIT