Skip to content

Commit 4e8009c

Browse files
committed
Add section to the readme about configuring .babelrc
1 parent e924270 commit 4e8009c

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

readme.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1307,6 +1307,32 @@ Here's an example `.babelrc` file:
13071307
}
13081308
```
13091309

1310+
The `next/babel` preset includes everything needed to transpile React applications. This includes:
1311+
1312+
- preset-env
1313+
- preset-react
1314+
- plugin-proposal-class-properties
1315+
- plugin-proposal-object-rest-spread
1316+
- plugin-transform-runtime
1317+
- styled-jsx
1318+
1319+
These presets / plugins **should not** be added to your custom `.babelrc`. Instead you can configure them on the `next/babel` preset:
1320+
1321+
```json
1322+
{
1323+
"presets": [
1324+
["next/babel", {
1325+
"preset-env": {},
1326+
"transform-runtime": {},
1327+
"styled-jsx": {}
1328+
}]
1329+
],
1330+
"plugins": []
1331+
}
1332+
```
1333+
1334+
The `modules` option on `"preset-env"` should be kept to `false` otherwise webpack code splitting is disabled.
1335+
13101336
#### Exposing configuration to the server / client side
13111337

13121338
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.

0 commit comments

Comments
 (0)