DEV Community

Discussion on: Restructure with ease thanks to Typescript path mappings

Collapse
 
luqeckr profile image
Luqman Hakim

you shouldn't change the baseUrl, it'll make your life easier..
the path will be like this:
"~app/*": ["src/app/*"],

with this, you don't have to change your imports all at once..

Collapse
 
scooperdev profile image
Stephen Cooper

Thanks for the heads up! I did not run into the issue of having to change all my imports at once with my current project but can see why this might cause issues.

Setup without modifying the value of the baseUrl.

"compilerOptions": {
    "baseUrl": "./",
    "paths": {
      "~app/*": ["src/app/*"],
      "~environments": ["src/environments/environment"],
    }
  }