Skip to content

Commit

Permalink
Update Webpack guide for React 15.5
Browse files Browse the repository at this point in the history
  • Loading branch information
ericgio committed Aug 7, 2017
1 parent 45454b2 commit cec0614
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions docs/guides/webpack.md
Expand Up @@ -87,6 +87,38 @@ module.exports = {
};
```

## React 15.5 Compatibility

As of React 15.5, `react/addons` is gone and `react-addons-test-utils` is deprecated. You should install the `react-test-renderer` dependency and use that instead:

#### Webpack 1
```js
/* webpack.config.js */
module.exports = {
// ...
externals: {
'react/lib/ExecutionEnvironment': true,
'react/lib/ReactContext': true,
'react-test-renderer': true,
},
// ...
};
```

#### Webpack 2+
```js
/* webpack.config.js */
module.exports = {
// ...
externals: {
'react/lib/ExecutionEnvironment': 'react',
'react/lib/ReactContext': 'react',
'react-test-renderer': 'react-test-renderer',
},
// ...
};
```

## Example Projects

- [enzyme-example-karma-webpack](https://github.com/lelandrichardson/enzyme-example-karma-webpack)

0 comments on commit cec0614

Please sign in to comment.