Skip to content

Commit 85545a4

Browse files
committed
Update README.md regarding babel [ci skip]
Updates the readme to describe the new behavior of Babel and Gatsby.
1 parent 6789c2c commit 85545a4

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

README.md

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -366,10 +366,28 @@ export.postBuild = function(pages, callback) {
366366

367367
### Configuring Babel
368368

369-
For **Webpack loaded code** you can't modify Babel's behavior as normal
370-
by modifying the .babelrc in your site's root directory.
371-
372-
Instead you'll need to modify the Webpack babel loader as [described
369+
You can modify Babel's behavior as normal by either providing a `.babelrc` in
370+
your site's root directory or by adding a "babel" section in your site's
371+
`package.json`. You can find out more about how to configure babel
372+
[here](https://babeljs.io/docs/usage/babelrc/).
373+
374+
Gatsby by default will use your Babel configuration over the default if it can
375+
find it. Gatsby will automatically add react-hmre to your Babel config during
376+
development.
377+
378+
Note that if you want to use babel-plugin that is not provided by Gatsby, you
379+
will have to also add it to your package.json. You can use any babel-plugin
380+
that Gatsby packs as a dependency without having to add it to your own
381+
package.json:
382+
383+
* babel-plugin-add-module-exports
384+
* babel-plugin-transform-object-assign
385+
* babel-preset-es2015
386+
* babel-preset-react
387+
* babel-preset-stage-0
388+
389+
If you need to change the loader to be something completely custom. You will
390+
have to define your own webpack loaded by following the steps [described
373391
above](https://github.com/gatsbyjs/gatsby#how-to-use-your-own-webpack-loaders).
374392

375393
### Deploying to Github Pages (and other hosts where your site's links need prefixes)

0 commit comments

Comments
 (0)