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.
The new option fixes #2644, which is a reactivation of #287, and has been in discussion in #2034.
Background
The current behavior of the compiler when using
--outDir
is to duplicate the input structure in the output under the value of--outDir
. the root of the input is computed as the longest common path of all source (.ts and not .d.ts) files. so an input ofFolderA\FolderB\1.ts
andFolderA\FolderB\2.ts
would result in computing the commonSourceRoot toFolderA\FolderB\
. now if a new fileFolderA\3.ts
is added to the input, the commonSourceRoot will pop out toFolderA\
.This is generally undesirable and can be confusing. it also does not allow for folders that do not contain .ts files to be replicated in the output.
--rootDir
flagThe new flag is used to customize the commonSourceRoot instead of automatically calculating it.
The same rules apply, i.e. all source files (.ts) should be under the rootDir, otherwise the output generation may not be correct.
The name
rootDir
is meant to resembleoutDir
as both flags go together.