app.js 1.58 KB
Newer Older
邓晓峰's avatar
邓晓峰 committed
1
/* eslint-disable */
dengxiaofeng's avatar
dengxiaofeng committed
2
import '!file-loader?name=[name].[ext]!./images/favicon.ico';
dengxiaofeng's avatar
dengxiaofeng committed
3
import './global.less';
dengxiaofeng's avatar
dengxiaofeng committed
4
import '@babel/polyfill';
dengxiaofeng's avatar
dengxiaofeng committed
5
import 'antd/dist/antd.less';
dengxiaofeng's avatar
dengxiaofeng committed
6 7 8 9 10
import 'file-loader?name=.htaccess!./.htaccess'; // eslint-disable-line import/extensions
import 'sanitize.css/sanitize.css';

import React from 'react';
import ReactDOM from 'react-dom';
11
// import { ArcGISMap as MapComponent } from '@wisdom-map/arcgismap';
邓晓峰's avatar
邓晓峰 committed
12 13
import { ConfigProvider } from 'antd';
import zhCN from 'antd/es/locale/zh_CN';
dengxiaofeng's avatar
dengxiaofeng committed
14 15
import { ConnectedRouter } from 'connected-react-router/immutable';
import Immutable from 'immutable';
dengxiaofeng's avatar
dengxiaofeng committed
16 17 18
import { Provider } from 'react-redux';

import configureStore from './configureStore';
dengxiaofeng's avatar
dengxiaofeng committed
19
import App from './containers/App';
20
import config from './routes/config';
邓晓峰's avatar
邓晓峰 committed
21 22
import history from './utils/history';

dengxiaofeng's avatar
dengxiaofeng committed
23
const initialState = Immutable.Map();
dengxiaofeng's avatar
dengxiaofeng committed
24 25 26
const store = configureStore(initialState, history);
const MOUNT_NODE = document.getElementById('app');
const render = () => {
27 28 29 30 31 32 33 34 35 36 37 38
  ReactDOM.render(
    <Provider store={store}>
      <ConnectedRouter history={history}>
        <ConfigProvider locale={zhCN}>
          {/* <PictureWallProvider> */}
          <App routesConfig={config} />
          {/* </PictureWallProvider> */}
        </ConfigProvider>
      </ConnectedRouter>
    </Provider>,
    MOUNT_NODE,
  );
dengxiaofeng's avatar
dengxiaofeng committed
39 40
};

dengxiaofeng's avatar
dengxiaofeng committed
41
if (module.hot) {
42 43 44 45
  module.hot.accept(['./containers/App'], () => {
    ReactDOM.unmountComponentAtNode(MOUNT_NODE);
    render();
  });
dengxiaofeng's avatar
dengxiaofeng committed
46
}
张烨's avatar
张烨 committed
47
if (MOUNT_NODE) {
48
  render();
dengxiaofeng's avatar
dengxiaofeng committed
49
}
dengxiaofeng's avatar
dengxiaofeng committed
50 51

if (process.env.NODE_ENV === 'production') {
52
  require('offline-plugin/runtime').install(); // eslint-disable-line global-require
dengxiaofeng's avatar
dengxiaofeng committed
53
}