Skip to content

Commit 0b6a5f3

Browse files
committed
add documentation about custom babel configuration
1 parent ff0da30 commit 0b6a5f3

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

packages/react-scripts/scripts/eject.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ prompt(
130130
);
131131

132132
// Add Babel config if there is no local babel config
133-
if (isLocalBabelExists()) {
133+
if (!isLocalBabelExists()) {
134134
console.log(' Adding ' + cyan('Babel') + ' preset');
135135
appPackage.babel = babelConfig;
136136
}

packages/react-scripts/template/.babelrc

-3
This file was deleted.

packages/react-scripts/template/README.md

+13
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ You can find the most recent version of this guide [here](https://github.com/fac
2828
- [Using Global Variables](#using-global-variables)
2929
- [Adding Bootstrap](#adding-bootstrap)
3030
- [Adding Flow](#adding-flow)
31+
- [Adding Custom Babel Configuration](#adding-custom-babel-configuration)
3132
- [Adding Custom Environment Variables](#adding-custom-environment-variables)
3233
- [Can I Use Decorators?](#can-i-use-decorators)
3334
- [Integrating with a Node Backend](#integrating-with-a-node-backend)
@@ -494,6 +495,18 @@ In the future we plan to integrate it into Create React App even more closely.
494495

495496
To learn more about Flow, check out [its documentation](https://flowtype.org/).
496497

498+
## Adding Custom Babel Configuration
499+
500+
You can override builtin babel presets and plugins [via .babelrc or package.json](https://babeljs.io/docs/usage/babelrc/).
501+
502+
>Note: Don't forget to install babel-preset-react-app and include "react-app" preset into your .babelrc or package.json babel configuration section.
503+
504+
```js
505+
{
506+
"presets": ["react-app", "stage-0"]
507+
}
508+
```
509+
497510
## Adding Custom Environment Variables
498511

499512
>Note: this feature is available with `react-scripts@0.2.3` and higher.

0 commit comments

Comments
 (0)