IE错误 - 操作必须是普通对象。使用自定义中间件进行异步操作

时间:2017-09-20 14:56:15

标签: reactjs redux redux-thunk

我们在IE上遇到上述错误(下面附带截图)的问题仅为2周,尽管它适用于Chrome和FireFox。

IE Error Screenshot

store.js

    import rootReducer from '../reducers';
    import thunk from 'redux-thunk';
    import {applyMiddleware, compose, createStore} from 'redux';
    import createLogger from 'redux-logger';
    import routes from '../routes';
    import createHistory from 'history/lib/createHashHistory';
    import {reduxReactRouter} from 'redux-router';
    import config from '../common/config';

    export default function configureStore(initialState) {
    let createStoreWithMiddleware;

    const logger = createLogger();
    let history = createHistory({
        queryKey: false
    });

    let middleware = applyMiddleware(thunk, logger);
    if(config.Environment == 'PROD'){
        middleware = applyMiddleware(thunk);
    }

    createStoreWithMiddleware = compose(
        middleware,reduxReactRouter({ routes, history })
    );

    const store = createStoreWithMiddleware(createStore)(rootReducer, initialState);

    if (module.hot) {
        module.hot
            .accept('../reducers', () => {
                const nextRootReducer = require('../reducers/index');
                store.replaceReducer(nextRootReducer);
            });
    }

    return store;
    }

的package.json

    ...... "dependencies": { "babel": "^5.8.23", "babel-core": "^5.2.17", "babel-loader": "^5.0.0", "body-parser": "^1.12.4", "cookie-parser": "^1.3.3", "debug": "^2.2.0", "dotenv": "^1.2.0", "errorhandler": "^1.4.2", "es6-promise": "^3.0.2", ..... "highcharts": "5.0.0", "history": "^1.9.0", ..... "lodash": "^4.13.1", "material-ui": "0.18.2", "material-ui-pagination": "^1.0.1", .... "react": "15.4.1", "react-addons-css-transition-group": "^15.2.1", "react-addons-linked-state-mixin": "^15.2.1", ... "react-redux": "^4.4.5", "react-router": "^2.6.0", "react-tap-event-plugin": "2.0.1", "redux": "^3.5.2", "redux-logger": "^2.6.1", "redux-router": "^2.0.0", "redux-thunk": "^2.1.0", "rimraf": "^2.5.2" }, "devDependencies": { "babel-loader": "^5.0.0", "file-loader": "^0.8.4", "redux-devtools": "^3.0.1", "redux-devtools-dock-monitor": "^1.0.1", "redux-devtools-log-monitor": "^1.0.1", "webpack": "^1.11.0", "webpack-dev-server": "^1.10.1" }, ......     

0 个答案:

没有答案