Reactjs Haste模块映射中不存在模块'EmployeeFormReducer'
我正在处理React本机应用程序,并在出现以下错误时重新加载模拟器: Haste模块映射中不存在模块Reactjs Haste模块映射中不存在模块'EmployeeFormReducer',reactjs,react-native,Reactjs,React Native,我正在处理React本机应用程序,并在出现以下错误时重新加载模拟器: Haste模块映射中不存在模块EmployeeFormReducer EmployeeFormReducer是我已经拥有的一个reducer,我在模拟器中测试它之前添加了EMPLOYEE\u UPDATE案例: import { EMPLOYEE_UPDATE } from '../actions/types'; const INITIAL_STATE = { name: '', phone: '', shift
EmployeeFormReducer
EmployeeFormReducer
是我已经拥有的一个reducer,我在模拟器中测试它之前添加了EMPLOYEE\u UPDATE
案例:
import { EMPLOYEE_UPDATE } from '../actions/types';
const INITIAL_STATE = {
name: '',
phone: '',
shift: ''
};
export default (state = INITIAL_STATE, action) => {
switch (action.type) {
case EMPLOYEE_UPDATE:
return { ...state, [action.payload.prop]: action.payload.value };
default:
return state;
}
};
我没有忘记将其添加到我的Combinereducer中:
import { combineReducers } from 'redux';
import AuthReducer from './AuthReducer';
import EmployeeFormReducer from 'EmployeeFormReducer';
export default combineReducers({
auth: AuthReducer,
employeeForm: EmployeeFormReducer
});
我认为这是基于facebooks github上记录的React Native问题:
这可能与
解决
以下是:
1.清除看守人手表:watchman watch del all
。
2.删除node\u模块
文件夹:rm-rf node\u模块和&npm安装
。
3.重置高速捆绑机缓存:rm-rf/tmp/Metro捆绑机缓存-*
或npm启动---重置缓存
。4.移除加速缓存:`rm-rf
/tmp/haste map react本机包装机-*
但是,我运行了所有这些命令,但仍然出现了错误。在导入过程中,您应该指定要导入的文件的路径,看看如何导入“AuthReducer”,因此“EmployeeFormReducer”的导入应该是:
import EmployeeFormReducer from './EmployeeFormReducer';
或者任何文件的完整路径。这就是我答应自己不加班的原因。非常感谢。