xcatliu / react-ie8

Make your React app work in IE8
http://react-ie8.xcatliu.com/
998 stars 162 forks source link

react-router-redux 4.x 中的Object.defineProperty问题 #26

Closed codering closed 8 years ago

codering commented 8 years ago

你好,我看到react-router-redux 4.x 中发布的代码部分如下:

Object.defineProperty(exports, 'LOCATION_CHANGE', {
    enumerable: true,
    get: function get() {
      return _reducer.LOCATION_CHANGE;
    }
  });
  Object.defineProperty(exports, 'routerReducer', {
    enumerable: true,
    get: function get() {
      return _reducer.routerReducer;
    }
  });
....

这样的代码 哪怕用了polyfill 也没法兼容IE8了吧 ?

codering commented 8 years ago

哈,看到官方的issue了, 等待修复中 https://github.com/reactjs/react-router-redux/issues/382

dyf2015 commented 8 years ago

@codering 官方修复了吗?

codering commented 8 years ago

@dyf2015 我现在的做法是单独引用, 比如

import syncHistoryWithStore  from 'react-router-redux/lib/sync'
import {routerReducer} from 'react-router-redux/lib/reducer'

你可以看下的源码index.js https://github.com/reactjs/react-router-redux/blob/master/src/index.js


export syncHistoryWithStore from './sync'
export { LOCATION_CHANGE, routerReducer } from './reducer'

export {
  CALL_HISTORY_METHOD,
  push, replace, go, goBack, goForward,
  routerActions
} from './actions'
export routerMiddleware from './middleware'

其实就只有index.js用到export from 的语法, 按需单独引用就ok的,注意发布到npm时是在lib目录下。

dyf2015 commented 8 years ago

感谢

发自我的 iPhone

在 2016年6月13日,09:54,Justin notifications@github.com<mailto:notifications@github.com> 写道:

@dyf2015https://github.com/dyf2015 我现在的做法是单独引用, 比如

import syncHistoryWithStore from 'react-router-redux/lib/sync' import {routerReducer} from 'react-router-redux/lib/reducer'

你可用看下的源码index.js https://github.com/reactjs/react-router-redux/blob/master/src/index.js

export syncHistoryWithStore from './sync' export { LOCATION_CHANGE, routerReducer } from './reducer'

export { CALL_HISTORY_METHOD, push, replace, go, goBack, goForward, routerActions } from './actions' export routerMiddleware from './middleware'

按需单独引用就ok的。

― You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/xcatliu/react-ie8/issues/26#issuecomment-225474727, or mute the threadhttps://github.com/notifications/unsubscribe/APjvyS2Fjc_WNRt7vv2GtwhCy0F6NyV2ks5qLLg7gaJpZM4IYvad.