Skip to content

Support for ${configDir} syntax #156

@2LeoCode

Description

@2LeoCode

Since typescript 5.5, it is possible to use the ${configDir} variable inside include/exclude clauses to reference the directory path where the current tsconfig is located, but unfortunately vite-tsconfig-paths does not support this feature yet, so path aliases are not set when using it.

Example

/* tsconfig.base.json */
{
  "include": ["${configDir}/src"],
  "exclude": ["${configDir}/dist", "${configDir}/node_modules"],
}
/* tsconfig.json */
{
  "files": [],
  "references": [
    {
      "path": "./tsconfig.app.json"
    },
    {
      "path": "./tsconfig.vite.json"
    }
  ]
}
/* tsconfig.app.json */
{
  "extends": "./tsconfig.base.json",
  "compilerOptions": {
    "paths": {
      "@components/*": [
        "./src/components/*"
      ],
      /* ... */
    }
  },
  "include": [
    "src"
  ]
}

If I remove the "include": ["src"] at the end of tsconfig.app.json, the path aliases stop working in vite, but it shouldn't since ${configDir)/src expands to ./src

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions