Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge pull request #251 from mbark/patch-1 #251

Merged
merged 1 commit into from
Jan 28, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions docs/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,29 @@ yarn add react-async

> This package requires `react` as a peer dependency. Please make sure to install that as well. If you want to use the
> `useAsync` hook, you'll need `[email protected]` or later.

## Targeting older browsers

If you are targeting older browsers you need to transpile `react-async` with babel.

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

In your `webpack.config.js` make sure that the rule for `babel-loader`:
* doesn't exclude `node_modules` from matching via the `exclude` pattern;
* excludes `core-js` as it shouldn't be transpiled;
* is passed the `configFile` option pointing to the `babel.config.js` file.

```
{
test: /\.(js|jsx)$/,
exclude: /\/node_modules\/core-js\//,
use: [{
loader: 'babel-loader',
options: {
configFile: './babel.config.js',
// This is recommended to enable when transpiling node_modules to improve build times for consecutive builds.
cacheDirectory: true,
}
}]
}
```