reactjsantdreact-app-rewired

React build failed: cannot read property 'name' of undefined


I'm using create-react-app template with typescript. On my local pc, run build successfully, but when run in CI server, build failed.

./src/store/redux/info/index.ts Syntax error: Cannot read property 'name' of undefined (0:undefined)

But there is no 'name' property in file

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",

Solution

  • It seems to be an issue with 'typescript-eslint'.

    It could be resolved by updating Typescript version to 3.8.x - as pointed out by user Phoebus at an other question: https://stackoverflow.com/a/60734819/5758225

    Github issue (and PR link in comments): https://github.com/typescript-eslint/typescript-eslint/issues/1746