Skip to content

Commit

Permalink
chore(package): switch to react-hot-loader (#1946)
Browse files Browse the repository at this point in the history
  • Loading branch information
layershifter authored and levithomason committed Aug 13, 2017
1 parent 3c22d18 commit 345848a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
}]
],
"env": {
"development": {
"plugins": "react-hot-loader/babel"
},
"test": {
"plugins": [
["istanbul", { "include": ["src"] }]
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
"babel-loader": "^7.0.0",
"babel-plugin-istanbul": "^4.1.4",
"babel-plugin-lodash": "^3.2.10",
"babel-plugin-react-transform": "^2.0.2",
"babel-plugin-transform-react-handled-props": "^0.2.3",
"babel-plugin-transform-react-remove-prop-types": "^0.3.2",
"babel-plugin-transform-runtime": "^6.15.0",
Expand Down Expand Up @@ -122,6 +121,7 @@
"react-docgen": "^2.13.0",
"react-document-title": "^2.0.2",
"react-dom": "15.5.4",
"react-hot-loader": "^3.0.0-beta.7",
"react-router": "^4.0.0",
"react-router-dom": "^4.0.0",
"react-test-renderer": "^15.5.4",
Expand Down
16 changes: 10 additions & 6 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const APP_ENTRY = paths.docsSrc('index.js')

webpackConfig.entry = __DEV__ ? {
app: [
'react-hot-loader/patch',
webpackHotMiddlewareEntry,
APP_ENTRY,
],
Expand Down Expand Up @@ -165,18 +166,21 @@ if (!__TEST__) {
// ------------------------------------
// Rules
// ------------------------------------
const jsLoaders = [{
loader: 'babel-loader',
options: {
cacheDirectory: true,
},
}]
if (__DEV__) jsLoaders.unshift('react-hot-loader/webpack')

webpackConfig.module.rules = [...webpackConfig.module.rules, {
//
// Babel
//
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
cacheDirectory: true,
},
},
use: jsLoaders,
}]

module.exports = webpackConfig

0 comments on commit 345848a

Please sign in to comment.