Skip to content

Commit a195fe8

Browse files
authored
fix($doc): update babel-config.md
1 parent a7df581 commit a195fe8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/babel-config.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ When using babel for the server, you'll have slightly different webpack config a
66
```
77
{
88
"presets": ["es2015", "react", "stage-2"],
9-
"plugins": ["dynamic-import-webpack", [
9+
"plugins": ["syntax-dynamic-import", "universal-import", [
1010
"css-modules-transform", {
1111
"generateScopedName": "[name]__[local]--[hash:base64:5]"
1212
}
1313
]]
1414
}
1515
```
1616

17-
- **[babel-plugin-dynamic-import-webpack](https://github.com/airbnb/babel-plugin-dynamic-import-webpack)** is needed to transpile `import()` into Webpack's `require.ensure` on the server. It requires Babylon v6.12.0. It won't do anything without running within Webpack, but it guards against transpilation errors--and this is fine since components aren't imported asynchronously on the server.
18-
*Also note: if you're using a version of Webpack prior to 2.2.0 you also need this.*
17+
- **[babel-plugin-syntax-dynamic-import](https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-dynamic-import)** is needed so `import()` doesn't break the Babel compilation.
18+
1919
- For CSS Modules, since you can't rely on webpack anymore to handle importing CSS, we recommend using
2020
[babel-plugin-css-modules-transform](https://github.com/michalkvasnicak/babel-plugin-css-modules-transform)
2121
to generate CSS class names on the server. What it does is take code like this:
@@ -83,10 +83,10 @@ plugins: [
8383
```
8484

8585
## Sample Boilerplate
86-
The following is an older boilerplate that will showcase babel being used with chunknames:
86+
The following is an older boilerplate that will showcase babel being used with chunknames *(without babel-plugin-universal-import)*:
8787

8888
- https://github.com/faceyspacey/flush-chunks-boilerplate-babel-chunknames
8989

90-
We highly recommend you checkout. We aren't promoting this route, but you can definitely learn from how its configured. Specifically how the server babel config is different from the client webpack config. Check the `.babelrc` and the webpack configs.
90+
We aren't promoting this route anymore, but you can definitely learn from how its configured. Specifically how the server babel config is different from the client webpack config. Check the `.babelrc` and the webpack configs. Just keep in mind that with the babel plugin u gotta use `babel-plugin-syntax-dynamic-import` as well, as shown at the top of this doc.
9191

9292

0 commit comments

Comments
 (0)