Skip to content

Commit 02733f4

Browse files
committed
fix(hotreloader): add workaround for react-router async routes
1 parent 0b06f15 commit 02733f4

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

client/routes.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable global-require */
12
import React from 'react';
23
import { Route, IndexRoute } from 'react-router';
34
import App from './modules/App/App';
@@ -9,6 +10,16 @@ if (typeof require.ensure !== 'function') {
910
};
1011
}
1112

13+
/* Workaround for async react routes to work with react-hot-reloader till
14+
https://github.com/reactjs/react-router/issues/2182 and
15+
https://github.com/gaearon/react-hot-loader/issues/288 is fixed.
16+
*/
17+
if (process.env.NODE_ENV !== 'production') {
18+
// Require async routes only in development for react-hot-reloader to work.
19+
require('./modules/Post/pages/PostListPage/PostListPage');
20+
require('./modules/Post/pages/PostDetailPage/PostDetailPage');
21+
}
22+
1223
// react-router setup with code-splitting
1324
// More info: http://blog.mxstbr.com/2016/01/react-apps-with-pages/
1425
export default (

0 commit comments

Comments
 (0)