【问题标题】:Unable to resolve module remote-redux-devtools无法解析模块 remote-redux-devtools
【发布时间】:2017-02-21 12:05:38
【问题描述】:

我即将为 react-native 应用设置远程调试。我添加了remote-redux-devtools 模块并导入了它。有谁知道为什么我会收到以下错误: UnableToResolveError: Unable to resolve module remote-redux-devtools from /Users/.../src/store/createStore.js: Module does not exist in the module map or in these directories:....

它位于node_modules 目录(node_modules/remote-redux-devtools)中。

【问题讨论】:

  • 你是怎么导入的?
  • 您可能需要重新启动打包程序.. 你这样做了吗?
  • 愚蠢的错误,这个解决了!谢谢

标签: reactjs react-native react-redux redux-devtools


【解决方案1】:

您也不需要为此使用模块。无论您在哪里创建商店,都定义一个 composeEnhancers 函数并将其应用到您的中间件:

const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose

const store = createStore(
  ...reducers,
  ...initialState,
  composeEnhancers(
    ...middleware
  )
)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-05-13
    • 2021-11-03
    • 2017-06-06
    • 2021-11-23
    • 2020-11-05
    • 2020-11-23
    • 2017-10-31
    • 2019-11-19
    相关资源
    最近更新 更多