Tsconfig inheritance: Do not resolve included files in an inherited tsconfig#15139
Merged
4 commits merged intoMay 8, 2017
Merged
Tsconfig inheritance: Do not resolve included files in an inherited tsconfig#151394 commits merged into
4 commits merged into
Conversation
zhengbli
reviewed
Apr 12, 2017
| let options: CompilerOptions = convertCompilerOptionsFromJsonWorker(json["compilerOptions"], basePath, errors, configFileName); | ||
| let options = (() => { | ||
| const { include, exclude, files, options } = parseConfig(json, host, basePath, configFileName, resolutionStack, errors); | ||
| if (include) json.include = include; |
| host: ParseConfigHost, | ||
| basePath: string, | ||
| configFileName: string, | ||
| resolutionStack: Path[] = [], |
There was a problem hiding this comment.
Put the parameter with default values last? Otherwise the default value will never be used as it can not be emitted.
| } | ||
|
|
||
| // If the path isn't a rooted or relative path, don't try to resolve it (we reserve the right to special case module-id like paths in the future) | ||
| if (!(isRootedDiskPath(extended) || startsWith(normalizeSlashes(extended), "./") || startsWith(normalizeSlashes(extended), "../"))) { |
mhegazy
approved these changes
May 8, 2017
This pull request was closed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #14539
The problem was that
parseJsonConfigFileContentrecursively calls itself.This function doesn't just parse the JSON config, it also resolves the files of everything in
includes. Since we don't use the resolvedincludesfrom a parent config, this is wasteful.Factored the parts out that just parse the config, so that when we parse an extended config, we don't try resolving includes for that.
You can verify the fix with:
I also noticed that we are modifying the input to this function; stopping that would technically be a breaking change, but it doesn't seem to have been documented in the first place, so probably a good idea to do that in another PR?