microsoft / microsoft/TypeScript
`--showConfig` doesn't resolve `paths`
Personne n'a encore pris cette issue.
- Langage dominant
- Go
- Étoiles
- 111k
- Forks
- 14.4k
- Merge moyen
- 1 j 19 h
- PR mergées (30 j)
- 117
Description
🔎 Search Terms
"showConfig", "paths", "extends", "relative"
🕗 Version & Regression Information
v5.2.2 (no regression AFAIK)
⏯ Playground Link
https://stackblitz.com/edit/stackblitz-starters-gst2kr?file=tsconfig.json
Commands:
-
npm run config->tsc --showConfig -
npm run trace->tsc --noEmit --traceResolution
Use this to confirm thatfoodoes resolve to./this-path-should-be-in-config/bar.ts
💻 Code
No response
🙁 Actual behavior
Given a tsconfig that extends another config:
./tsconfig.json
{
"extends": "./this-path-should-be-in-config/tsconfig.json"
}
./this-path-should-be-in-config/tsconfig.json
{
"compilerOptions": {
"paths": {
"foo": ["./bar"]
}
}
}
The resolved tsconfig (via tsc --showConfig) doesn't reflect that ./bar is actually resolved relative to ./this-path-should-be-in-config/tsconfig.json:
{
"compilerOptions": {
"paths": {
"foo": [
"./bar"
]
}
},
"files": [
"./file.ts"
]
}
🙂 Expected behavior
For the config to include the relevant information (e.g. the relative path):
{
"compilerOptions": {
"paths": {
"foo": [
"./this-path-should-be-in-config/bar"
]
}
},
"files": [
"./file.ts"
]
}
Currently, it seems to indicate that paths is resolved relative to the CWD. When it's in fact relative to this-path-should-be-in-config.
It's also impossible for a custom TypeScript paths resolver (e.g. https://github.com/privatenumber/get-tsconfig) to correctly resolve the paths aliases based on this output.
Additional information about the issue
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par la reproduction StackBlitz liée et exécutez npm run config (tsc --showConfig) ainsi que npm run trace (tsc --noEmit --traceResolution). Comparez les valeurs paths héritées dans les deux fichiers tsconfig.json avec le chemin de module résolu affiché par le tracing. C’est terminé lorsque --showConfig indique le chemin relatif au fichier de configuration étendu, tout en préservant la résolution d’alias démontrée.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- typescript
- Domaine
- compilers
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 45/100