DEV Community

Discussion on: Setup path aliases w/ React + Vite + TS

Collapse
 
annaspies profile image
Anna

Does this work for nested paths? I'm trying to do something like this, and the nested folder isn't working for me:

{
  "compilerOptions": {
    "baseUrl": ".",
    ...
    "paths": {
      "*": ["src/*", "node_modules/*"],
      "components/*": ["src/components/*"],
      "containers/*": ["src/containers/*"],
      "pages/*": ["src/constants/*"],
      "store/*": ["src/store/*"],
      "types/*": ["src/types/*"],
      "NestedFolder/*": [
        "src/components/NestedFolder/*"
      ],
    }
  },
  "include": ["src/**/*", "*"]
}
Enter fullscreen mode Exit fullscreen mode
Collapse
 
shekhardtu profile image
Hari Shekhar

Hi @anna
For multiple aliases, you can follow this answer on stackoverflow.
stackoverflow.com/a/75201776/3144344