Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

paths is not recognized when defined in a config via extends #224

Open
saevarb opened this issue Oct 29, 2022 · 0 comments
Open

paths is not recognized when defined in a config via extends #224

saevarb opened this issue Oct 29, 2022 · 0 comments

Comments

@saevarb
Copy link

saevarb commented Oct 29, 2022

Given two tsconfig.json files as follows

// foo/tsconfig.json
{
  "$schema": "https://json.schemastore.org/tsconfig",
  "compilerOptions": {
    ...
    "paths": {
      "~/*": ["src/*"]
    }
  },
  ...
}

// service/tsconfig.json
{
  "$schema": "https://json.schemastore.org/tsconfig",
  "extends": "foo/tsconfig.json",
  "compilerOptions": {
    "baseUrl": ".",
    "outDir": "./dist"
  },
  "include": [
    "src"
  ]
}

I.e. one shared base config where paths is defined and another that extends that base config to use in a specific project, tsconfig-paths does not properly recognize paths as defined. In order for it to recognize them, they need to be defined in the service/tsconfig.json, which does not align with how typescript does it. tsc will happily compile programs with the path mapping in the shared config, and it also outputs it when running tsc --showConfig in the service project, and incidentally, esbuild also happily resolves them as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant