You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/getting-started/installation.md
+26Lines changed: 26 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -14,3 +14,29 @@ yarn add react-async
14
14
15
15
> This package requires `react` as a peer dependency. Please make sure to install that as well. If you want to use the
16
16
> `useAsync` hook, you'll need `react@16.8.0` or later.
17
+
18
+
## Targeting older browsers
19
+
20
+
If you are targeting older browsers you need to transpile `react-async` with babel.
21
+
22
+
To transpile `node_modules` with babel you need to use a `babel.config.js`, for more information see [babel's documentation](https://babeljs.io/docs/en/configuration#whats-your-use-case).
23
+
24
+
In your `webpack.config.js` make sure that the rule for `babel-loader`:
25
+
* doesn't exclude `node_modules` from matching via the `exclude` pattern;
26
+
* excludes `core-js` as it shouldn't be transpiled;
27
+
* is passed the `configFile` option pointing to the `babel.config.js` file.
28
+
29
+
```
30
+
{
31
+
test: /\.(js|jsx)$/,
32
+
exclude: /\/node_modules\/core-js\//,
33
+
use: [{
34
+
loader: 'babel-loader',
35
+
options: {
36
+
configFile: './babel.config.js',
37
+
// This is recommended to enable when transpiling node_modules to improve build times for consecutive builds.
0 commit comments