It looks like there has been an update to React that doesn't allow you to set the "paths"
in the tsconfig.json
anylonger.
Nicely React just outputs a warning:
The following changes are being made to your tsconfig.json file:
- compilerOptions.paths must not be set (aliased imports are not supported)
then updates your tsconfig.json
and removes the entire "paths"
section for you. There is a way to get around this run
npm run eject
This will eject all of the create-react-scripts
settings by adding config
and scripts
directories and build/config files into your project. This also allows a lot more control over how everything is built, named etc. by updating the {project}/config/*
files.
Then update your tsconfig.json
{
"compilerOptions": {
"baseUrl": "./src",
{…}
"paths": {
"assets/*": [ "assets/*" ],
"styles/*": [ "styles/*" ]
}
},
}