我试图通过github连接在Azure Azure上部署以下源代码,但是下面的错误正在停止构建,但是在我的本地linux盒中,它的工作正常,没有任何警告。
错误:src////WartReducer.js第3行:1:将箭头函数赋值给变量,然后导出为模块默认导入/不匿名默认导出
src/context/github/githubReducer.js第10行:1:将箭头函数赋值给变量,然后导出为模块默认导入/不匿名-默认-导出
alertReducer.js
import { SET_ALERT, REMOVE_ALERT } from "../types";
export default (state, action) => {
switch (action.type) {
case SET_ALERT:
return action.payload;
case REMOVE_ALERT:
return null;
default:
return state;
}
};githubReducer.js
// Importing types
import {
SEARCH_USERS,
SET_LOADING,
CLEAR_USERS,
GET_USER,
GET_REPOS,
} from "../types";
export default (state, action) => {
switch (action.type) {
case GET_USER:
return {
...state,
user: action.payload,
loading: false,
};
case GET_REPOS:
return {
...state,
repos: action.payload,
loading: false,
};
case SEARCH_USERS:
return {
...state,
users: action.payload,
loading: false,
};
case CLEAR_USERS:
return {
...state,
users: [],
loading: false,
};
case SET_LOADING:
return {
...state,
loading: true,
};
default:
return state;
}
};发布于 2021-09-21 08:26:24
不同的环境使用不同的JS发动机。有些函数可能不允许导出未命名的函数。尝尝这个。
const reducer (state, action) => {
switch (action.type) {
case SET_ALERT:
return action.payload;
case REMOVE_ALERT:
return null;
default:
return state;
}
};
export default reducerhttps://stackoverflow.com/questions/69265622
复制相似问题