mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Add section to the readme about configuring .babelrc
This commit is contained in:
parent
e9242705a3
commit
4e8009c107
26
readme.md
26
readme.md
|
@ -1307,6 +1307,32 @@ Here's an example `.babelrc` file:
|
|||
}
|
||||
```
|
||||
|
||||
The `next/babel` preset includes everything needed to transpile React applications. This includes:
|
||||
|
||||
- preset-env
|
||||
- preset-react
|
||||
- plugin-proposal-class-properties
|
||||
- plugin-proposal-object-rest-spread
|
||||
- plugin-transform-runtime
|
||||
- styled-jsx
|
||||
|
||||
These presets / plugins **should not** be added to your custom `.babelrc`. Instead you can configure them on the `next/babel` preset:
|
||||
|
||||
```json
|
||||
{
|
||||
"presets": [
|
||||
["next/babel", {
|
||||
"preset-env": {},
|
||||
"transform-runtime": {},
|
||||
"styled-jsx": {}
|
||||
}]
|
||||
],
|
||||
"plugins": []
|
||||
}
|
||||
```
|
||||
|
||||
The `modules` option on `"preset-env"` should be kept to `false` otherwise webpack code splitting is disabled.
|
||||
|
||||
#### Exposing configuration to the server / client side
|
||||
|
||||
The `config` key allows for exposing runtime configuration in your app. All keys are server only by default. To expose a configuration to both the server and client side you can use the `public` key.
|
||||
|
|
Loading…
Reference in a new issue