tsconfig.json gets reset after yarn start React app
There's a workaround.
- 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/*"]
}
}
}
- 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