Skip to content

Commit 172c91b

Browse files
author
likun7981
committed
remove react-hot-loader
1 parent 3b209fc commit 172c91b

File tree

10 files changed

+29
-97
lines changed

10 files changed

+29
-97
lines changed

.babelrc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"react"
66
],
77
"plugins":[
8-
"transform-runtime",
9-
"react-hot-loader/babel"
8+
"transform-runtime"
109
]
1110
}

build/webpack-config/base.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ module.exports = (paths) => {
2323
});
2424
if (__DEV__) {
2525
App.unshift('webpack-hot-middleware/client');
26-
App.unshift('react-hot-loader/patch');
2726
}
2827
return {
2928
context: paths.root(),

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
"less-loader": "^2.2.3",
5656
"line-debugger": "^0.0.1",
5757
"mocha": "^3.2.0",
58-
"react-hot-loader": "3.0.0-beta.6",
5958
"redbox-react": "^1.3.3",
6059
"style-loader": "^0.13.1",
6160
"url-loader": "^0.5.7",

src/main.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const store = createStore(initialState);
1313
// Render Setup
1414
// ========================================================
1515
const MOUNT_NODE = document.getElementById('root');
16+
console.log(ReactDOM);
1617
let render = () => {
1718
const routes = require('./routes/index').default(store); // !important
1819
ReactDOM.render(
@@ -21,14 +22,7 @@ let render = () => {
2122
);
2223
};
2324
if (__DEV__ && module.hot) {
24-
const AppContainer = require('react-hot-loader').AppContainer; // eslint-disable-line
25-
const renderApp = () => {
26-
const routes = require('./routes/index').default(store); // !important
27-
ReactDOM.render(
28-
<AppContainer><App store={store} routes={routes} /></AppContainer>,
29-
MOUNT_NODE
30-
);
31-
};
25+
const renderApp = render;
3226
const renderError = (error) => {
3327
const RedBox = require('redbox-react').default; // eslint-disable-line
3428
ReactDOM.render(<RedBox error={error} />, MOUNT_NODE);
@@ -41,6 +35,7 @@ if (__DEV__ && module.hot) {
4135
}
4236
};
4337
module.hot.accept('./routes/index', () => {
38+
ReactDOM.unmountComponentAtNode(MOUNT_NODE);
4439
render();
4540
});
4641
}

src/reducers/location.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ export function locationChange(location = '/') {
1212
payload: location
1313
};
1414
}
15-
1615
// ------------------------------------
1716
// Specialized Action Creator
1817
// ------------------------------------

src/routes/increase/containers/increaseContainer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { connect } from 'react-redux';
2-
import { actions } from '../reducers/increase';
2+
import { actions } from '../reducers/Increase';
33

4-
import IncreaseComponents from '../components/increaseComponent';
4+
import IncreaseComponents from '../components/IncreaseComponent';
55

66
const mapDispatchToProps = actions;
77

src/routes/increase/index.js

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
1-
// import { injectReducer } from 'REDUCER_TOOL';
2-
3-
// export default store => ({
4-
// path: 'counter',
5-
// getComponent(nextState, cb) {
6-
// require.ensure([], (require) => {
7-
// const Counter = require('./containers/CounterContainer').default;
8-
// const reducer = require('./reducers/Counter').default;
9-
// injectReducer(store, { key: 'counter', reducer });
10-
// cb(null, Counter);
11-
// }, 'counter');
12-
// }
13-
// });
14-
import container from './containers/increaseContainer';
15-
import reducer from './reducers/increase';
16-
import component from './components/increaseComponent';
1+
import container from './containers/IncreaseContainer';
2+
import reducer from './reducers/Increase';
3+
import component from './components/IncreaseComponent';
174

185
export default component;
196
export { reducer, container, component };

src/routes/index.js

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,19 @@ const createChildRoute = (path, store) => ({
66
path,
77
getComponent(nextState, cb) {
88
const injectReducer = injectReducerFactory(store);
9-
// System.import(`./${path}/index`).then((routeModule) => {
10-
// const { container, reducer } = routeModule;
11-
// injectReducer(`${path}`, reducer);
12-
// cb(null, container);
13-
// });
14-
require.ensure([], (require) => {
15-
const routeModule = require('./increase');
9+
System.import(`./${path}/index`).then((routeModule) => {
1610
const { container, reducer } = routeModule;
17-
injectReducer('increase', reducer);
11+
injectReducer(`${path}`, reducer);
1812
cb(null, container);
19-
}, 'increase');
13+
});
2014
}
2115
});
22-
// const paths = ['increase'];
16+
const paths = ['increase'];
2317
export const createRoutes = store => ({
2418
path: '/',
2519
component: CoreLayout,
2620
indexRoute: Home,
27-
childRoutes: [createChildRoute('increase', store)]
21+
childRoutes: paths.map(path => createChildRoute(path, store))
2822
});
2923

3024
export default createRoutes;

src/store/createStore.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,15 @@ export default (initialState = {}) => {
2525
)
2626
);
2727
store.asyncReducers = {};
28-
// store.unsubscribeHistory = browserHistory.listen(updateLocation(store));
28+
29+
// Anywhere, you can call store.unsubscribeHistory() to cancel subscribe;
30+
store.unsubscribeHistory = browserHistory.listen(updateLocation(store));
31+
32+
// Make reducers hot reloadable, see http://mxs.is/googmo
2933
if (module.hot) {
3034
module.hot.accept('../utils/reducerTool', () => {
31-
System.import('../utils/reducerTool').then((module) => {
32-
const makeReducer = module.default;
33-
store.replaceReducer(makeReducer(store.asyncReducers));
34-
});
35+
const makeReducer = require('../utils/reducerTool').default;
36+
store.replaceReducer(makeReducer(store.asyncReducers));
3537
});
3638
}
3739

yarn.lock

Lines changed: 8 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@ babel-runtime@^6.0.0, babel-runtime@^6.11.6, babel-runtime@^6.18.0, babel-runtim
894894
core-js "^2.4.0"
895895
regenerator-runtime "^0.10.0"
896896

897-
babel-template@^6.14.0, babel-template@^6.15.0, babel-template@^6.16.0, babel-template@^6.7.0, babel-template@^6.8.0:
897+
babel-template@^6.14.0, babel-template@^6.15.0, babel-template@^6.16.0, babel-template@^6.8.0:
898898
version "6.16.0"
899899
resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.16.0.tgz#e149dd1a9f03a35f817ddbc4d0481988e7ebc8ca"
900900
dependencies:
@@ -1764,10 +1764,6 @@ dom-serializer@0:
17641764
domelementtype "~1.1.1"
17651765
entities "~1.1.1"
17661766

1767-
dom-walk@^0.1.0:
1768-
version "0.1.1"
1769-
resolved "https://registry.yarnpkg.com/dom-walk/-/dom-walk-0.1.1.tgz#672226dc74c8f799ad35307df936aba11acd6018"
1770-
17711767
domain-browser@^1.1.1:
17721768
version "1.1.7"
17731769
resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-1.1.7.tgz#867aa4b093faa05f1de08c06f4d7b21fdf8698bc"
@@ -2492,13 +2488,6 @@ glob@7.0.5:
24922488
once "^1.3.0"
24932489
path-is-absolute "^1.0.0"
24942490

2495-
global@^4.3.0:
2496-
version "4.3.1"
2497-
resolved "https://registry.yarnpkg.com/global/-/global-4.3.1.tgz#5f757908c7cbabce54f386ae440e11e26b7916df"
2498-
dependencies:
2499-
min-document "^2.19.0"
2500-
process "~0.5.1"
2501-
25022491
globals@^9.0.0, globals@^9.14.0:
25032492
version "9.14.0"
25042493
resolved "https://registry.yarnpkg.com/globals/-/globals-9.14.0.tgz#8859936af0038741263053b39d0e76ca241e4034"
@@ -3308,7 +3297,7 @@ lodash@^3.8.0:
33083297
version "3.10.1"
33093298
resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6"
33103299

3311-
lodash@^4.0.0, lodash@^4.0.1, lodash@^4.14.0, lodash@^4.16.4, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.5.0, lodash@^4.6.1:
3300+
lodash@^4.0.0, lodash@^4.0.1, lodash@^4.14.0, lodash@^4.16.4, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.5.0:
33123301
version "4.17.2"
33133302
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.2.tgz#34a3055babe04ce42467b607d700072c7ff6bf42"
33143303

@@ -3456,12 +3445,6 @@ mime@1.2.x:
34563445
version "1.2.11"
34573446
resolved "https://registry.yarnpkg.com/mime/-/mime-1.2.11.tgz#58203eed86e3a5ef17aed2b7d9ebd47f0a60dd10"
34583447

3459-
min-document@^2.19.0:
3460-
version "2.19.0"
3461-
resolved "https://registry.yarnpkg.com/min-document/-/min-document-2.19.0.tgz#7bd282e3f5842ed295bb748cdd9f1ffa2c824685"
3462-
dependencies:
3463-
dom-walk "^0.1.0"
3464-
34653448
minimalistic-assert@^1.0.0:
34663449
version "1.0.0"
34673450
resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.0.tgz#702be2dda6b37f4836bcb3f5db56641b64a1d3d3"
@@ -4176,10 +4159,6 @@ process@^0.11.0, process@~0.11.0:
41764159
version "0.11.9"
41774160
resolved "https://registry.yarnpkg.com/process/-/process-0.11.9.tgz#7bd5ad21aa6253e7da8682264f1e11d11c0318c1"
41784161

4179-
process@~0.5.1:
4180-
version "0.5.2"
4181-
resolved "https://registry.yarnpkg.com/process/-/process-0.5.2.tgz#1638d8a8e34c2f440a91db95ab9aeb677fc185cf"
4182-
41834162
progress@^1.1.8, progress@~1.1.8:
41844163
version "1.1.8"
41854164
resolved "https://registry.yarnpkg.com/progress/-/progress-1.1.8.tgz#e260c78f6161cdd9b0e56cc3e0a85de17c7a57be"
@@ -4290,10 +4269,6 @@ react:
42904269
loose-envify "^1.1.0"
42914270
object-assign "^4.1.0"
42924271

4293-
react-deep-force-update@^2.0.1:
4294-
version "2.0.1"
4295-
resolved "https://registry.yarnpkg.com/react-deep-force-update/-/react-deep-force-update-2.0.1.tgz#4f7f6c12c3e7de42f345992a3c518236fa1ecad3"
4296-
42974272
react-dom:
42984273
version "15.4.1"
42994274
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-15.4.1.tgz#d54c913261aaedb17adc20410d029dcc18a1344a"
@@ -4302,23 +4277,6 @@ react-dom:
43024277
loose-envify "^1.1.0"
43034278
object-assign "^4.1.0"
43044279

4305-
react-hot-loader@3.0.0-beta.6:
4306-
version "3.0.0-beta.6"
4307-
resolved "https://registry.yarnpkg.com/react-hot-loader/-/react-hot-loader-3.0.0-beta.6.tgz#463fac0bfc8b63a8385258af20c91636abce75f4"
4308-
dependencies:
4309-
babel-template "^6.7.0"
4310-
global "^4.3.0"
4311-
react-deep-force-update "^2.0.1"
4312-
react-proxy "^3.0.0-alpha.0"
4313-
redbox-react "^1.2.5"
4314-
source-map "^0.4.4"
4315-
4316-
react-proxy@^3.0.0-alpha.0:
4317-
version "3.0.0-alpha.1"
4318-
resolved "https://registry.yarnpkg.com/react-proxy/-/react-proxy-3.0.0-alpha.1.tgz#4400426bcfa80caa6724c7755695315209fa4b07"
4319-
dependencies:
4320-
lodash "^4.6.1"
4321-
43224280
react-redux:
43234281
version "5.0.0"
43244282
resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-5.0.0.tgz#2693227b19876b6e0047f4b94eb4910f43b677ca"
@@ -4421,7 +4379,7 @@ rechoir@^0.6.2:
44214379
dependencies:
44224380
resolve "^1.1.6"
44234381

4424-
redbox-react, redbox-react@^1.2.5:
4382+
redbox-react:
44254383
version "1.3.3"
44264384
resolved "https://registry.yarnpkg.com/redbox-react/-/redbox-react-1.3.3.tgz#63ec9c2cb9c620c46e2b9f8543b4898f1b787e41"
44274385
dependencies:
@@ -4803,16 +4761,16 @@ source-map@^0.1.41:
48034761
dependencies:
48044762
amdefine ">=0.0.4"
48054763

4806-
source-map@^0.4.4, source-map@0.4.x:
4764+
source-map@^0.5.0, source-map@^0.5.3, source-map@^0.5.6, source-map@~0.5.1, source-map@~0.5.3:
4765+
version "0.5.6"
4766+
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.6.tgz#75ce38f52bf0733c5a7f0c118d81334a2bb5f412"
4767+
4768+
source-map@0.4.x:
48074769
version "0.4.4"
48084770
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b"
48094771
dependencies:
48104772
amdefine ">=0.0.4"
48114773

4812-
source-map@^0.5.0, source-map@^0.5.3, source-map@^0.5.6, source-map@~0.5.1, source-map@~0.5.3:
4813-
version "0.5.6"
4814-
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.6.tgz#75ce38f52bf0733c5a7f0c118d81334a2bb5f412"
4815-
48164774
spdx-correct@~1.0.0:
48174775
version "1.0.2"
48184776
resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-1.0.2.tgz#4b3073d933ff51f3912f03ac5519498a4150db40"

0 commit comments

Comments
 (0)