tsconfig.json gets reset after yarn start React app

There's a workaround.

  1. Create a new file, say "base-tsconfig.json" and put the baseUrl config and paths in there. Those won't be overwritten by CRA.
{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "@/*": ["src/*"]
    }
  }
}
  1. Extend the main tsconfig.json file with your custom configuration
{
  "extends": "./base-tsconfig.json"
}

More info here.


create-react-app currently removes the baseUrl property, I don't think paths are currently supported by them unfortunately :(

Read more here https://github.com/facebook/create-react-app/issues/5585

Tags:

Typescript