Skip to content

Commit

Permalink
feat(package):update antd
Browse files Browse the repository at this point in the history
  • Loading branch information
clojurie committed Jan 6, 2018
1 parent 00b8ad2 commit ca85bf6
Show file tree
Hide file tree
Showing 6 changed files with 203 additions and 194 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"webpack-dev-server": "^2.9.7"
},
"dependencies": {
"antd": "^2.9.1",
"antd": "^3.1.0",
"axios": "^0.16.2",
"core-js": "^2.5.1",
"create-react-class": "^15.6.2",
Expand All @@ -91,8 +91,8 @@
"preact": "^8.2.5",
"preact-compat": "^3.17.0",
"prop-types": "^15.6.0",
"react": "^15.6.2",
"react-dom": "^15.6.1",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-hot-loader": "^3.0.0-beta.7",
"react-redux": "^5.0.5",
"react-router": "^4.1.1",
Expand Down
25 changes: 13 additions & 12 deletions server/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
/**
* Created by huangjian on 2017/8/22.
*/
const webpack = require('webpack')
const WebpackDevServer = require('webpack-dev-server')
const errorOverlayMiddleware = require('react-error-overlay/middleware')
const config = require('../webpack.config')
const path = require('path')
const proxy = require('http-proxy-middleware')
const client = path.resolve(__dirname, '../src')
const webpack = require('webpack');
const WebpackDevServer = require('webpack-dev-server');
const errorOverlayMiddleware = require('react-error-overlay/middleware');
const config = require('../webpack.config');
const path = require('path');
const proxy = require('http-proxy-middleware');

const client = path.resolve(__dirname, '../src');

const server = new WebpackDevServer(webpack(config), {
hot: true,
Expand All @@ -29,19 +30,19 @@ const server = new WebpackDevServer(webpack(config), {
chunks: false
},
before(app) {
app.use(errorOverlayMiddleware())
app.use(errorOverlayMiddleware());
if (process.env.NODE_ENV !== 'production') {
app.use('/book/*', proxy({
target: 'https://www.easy-mock.com/mock/593611b991470c0ac101d474',
secure: false
}))
}));
}
}
})
});

// 将其他路由,全部返回index.html
server.app.get('*', (req, res) => {
res.sendFile(`${client}/index.html`);
})
});

module.exports = server
module.exports = server;
2 changes: 1 addition & 1 deletion server/server.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
module.exports = {
host: '127.0.0.1',
port: 3000
}
};
36 changes: 18 additions & 18 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
import React from 'react'
import ReactDOM from 'react-dom'
import { Provider } from 'react-redux'
import { AppContainer } from 'react-hot-loader'
import createStore from './store/createStore'
import App from './containers/EntryContainer'
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import { AppContainer } from 'react-hot-loader';
import createStore from './store/createStore';
import App from './containers/EntryContainer';

// ========================================================
// Store Instantiation
// ========================================================
const initialState = window.___INITIAL_STATE__
const store = createStore(initialState)
const initialState = window.___INITIAL_STATE__;
const store = createStore(initialState);

const MOUNT_NODE = document.getElementById('root')
const MOUNT_NODE = document.getElementById('root');

const render = (Component) =>
ReactDOM.render(
<AppContainer>
<Provider store={store}>
<Component store={store}/>
<Component store={store} />
</Provider>
</AppContainer>,
MOUNT_NODE
)
);

render(App)
render(App);

if(module.hot) {
if (module.hot) {
module.hot.accept('./containers/EntryContainer', () => {
setImmediate(() => {
ReactDOM.unmountComponentAtNode(MOUNT_NODE)
const NextRootContainer = require('./containers/EntryContainer').default
render(NextRootContainer)
})
})
ReactDOM.unmountComponentAtNode(MOUNT_NODE);
const NextRootContainer = require('./containers/EntryContainer').default;
render(NextRootContainer);
});
});
}
6 changes: 3 additions & 3 deletions src/routes/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Component } from 'react';
import { Route, Redirect, Match, Switch } from 'react-router-dom';
import React, {Component} from 'react';
import {Route, Redirect, Match, Switch} from 'react-router-dom';

import List from 'views/List';
import Content from 'views/Content';
Expand All @@ -16,7 +16,7 @@ class App extends Component {
}

render() {
const { store } = this.props;
const {store} = this.props;
return (
<CoreLayout>
<Switch>
Expand Down
Loading

0 comments on commit ca85bf6

Please sign in to comment.