我正在使用带有 typescript 的 create-react-app 模板。在我的本地电脑上,运行构建成功,但是在 CI 服务器中运行时,构建失败。
- 构建错误
./src/store/redux/info/index.ts Syntax error: Cannot read property 'name' of undefined (0:undefined)
但文件中没有“名称”属性
info/index.ts
export { default } from "./reducer";
export * from "./actions";
export * from "./types";
"react": "16.12.0",
"react-app-rewired": "2.1.5",
"antd": "3.26.5",
"antd-theme-webpack-plugin": "1.3.0",
"typescript": "3.7.4",
"build": "react-app-rewired --max-old-space-size=8192 build",
最佳答案
这似乎是 'typescript-eslint' 的问题。
可以通过将 Typescript 版本更新为 3.8.x 来解决 - 正如用户 Phoebus 在另一个问题中指出的那样:https://stackoverflow.com/a/60734819/5758225
Github 问题(以及评论中的 PR 链接):https://github.com/typescript-eslint/typescript-eslint/issues/1746
关于reactjs - React 构建失败 : cannot read property 'name' of undefined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60751032/