Allow 'paths' without 'baseUrl' (#40101)

* Allow paths without baseUrl

* Remove exception for leading * paths

* Add comment, remove commented code

* Update baselines

* Remove unnecessary default

* Fix test harness

* Fix baseline

* Resolve relative to host.getCurrentDirectory() with createProgram API
This commit is contained in:
Andrew Branch
2020-09-11 12:58:40 -07:00
committed by GitHub
parent aa2756a5d7
commit 9c8d11b5ed
26 changed files with 295 additions and 22 deletions

View File

@@ -2509,6 +2509,13 @@ namespace ts {
parseOwnConfigOfJson(json, host, basePath, configFileName, errors) :
parseOwnConfigOfJsonSourceFile(sourceFile!, host, basePath, configFileName, errors);
if (ownConfig.options?.paths) {
// If we end up needing to resolve relative paths from 'paths' relative to
// the config file location, we'll need to know where that config file was.
// Since 'paths' can be inherited from an extended config in another directory,
// we wouldn't know which directory to use unless we store it here.
ownConfig.options.pathsBasePath = basePath;
}
if (ownConfig.extendedConfigPath) {
// copy the resolution stack so it is never reused between branches in potential diamond-problem scenarios.
resolutionStack = resolutionStack.concat([resolvedPath]);