Redux Form v8.0.1主模块字段无法解析

时间:2018-12-12 06:52:58

标签: reactjs react-native redux redux-form

我正在尝试将redux表单添加到我的项目中。当我使用最新的Redux格式版本(即8.0.1)时,出现以下错误。但是当我使用以前的版本时,它不会给出下面提到的错误,但是会在不同的模块中给出其他错误。

这些是我的Reducer.js和Store.js。

Reducer.js

import { reducer as form } from 'redux-form';

export default {
  form,
};

Reducer.js

import { createStore, applyMiddleware, compose } from 'redux';
import promiseMiddleware from 'redux-promise-middleware';
import thunk from 'redux-thunk';
import { persistStore, persistCombineReducers } from 'redux-persist';
import storage from 'redux-persist/lib/storage';
import { createLogger } from 'redux-logger';

import reducers from './Reducer';

const persistConfig = {
  key: 'root',
  storage,
  whitelist: ['user'],
};

const persistedReducer = persistCombineReducers(persistConfig, reducers);

const middlewares = [promiseMiddleware(), thunk];

// eslint-disable-next-line
if (__DEV__) {
  middlewares.push(createLogger());
}

export default () => {
  const store = createStore(persistedReducer, undefined, compose(applyMiddleware(...middlewares)));
  const persistor = persistStore(store);
  return { store, persistor };
};

现在我收到此错误。该如何解决?

尝试从文件redux-form解析模块/Users/sujin.v2px/React-Native/Changunarayan/src/redux/Reducer.js时,成功找到了软件包/Users/sujin.v2px/React-Native/Changunarayan/node_modules/redux-form/package.json。但是,该程序包本身指定了一个main无法解析的模块字段(/Users/sujin.v2px/React-Native/Changunarayan/node_modules/redux-form/index.js。实际上,这些文件都不存在:

1 个答案:

答案 0 :(得分:0)

此问题在v8.0.4中已解决。您应该更新依赖项。