Skip to content

Commit

Permalink
Merge pull request #27714 from Microsoft/okToSkipJsonOverrite
Browse files Browse the repository at this point in the history
Skip writing json file if it is going to overwrite same location
  • Loading branch information
sheetalkamat committed Oct 11, 2018
2 parents d19fb98 + 2787a27 commit 9cda8d6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 21 deletions.
4 changes: 3 additions & 1 deletion src/compiler/emitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ namespace ts {
else {
const ownOutputFilePath = getOwnEmitOutputFilePath(sourceFile.fileName, host, getOutputExtension(sourceFile, options));
// If json file emits to the same location skip writing it, if emitDeclarationOnly skip writing it
const jsFilePath = options.emitDeclarationOnly ? undefined : ownOutputFilePath;
const isJsonEmittedToSameLocation = isJsonSourceFile(sourceFile) &&
comparePaths(sourceFile.fileName, ownOutputFilePath, host.getCurrentDirectory(), !host.useCaseSensitiveFileNames()) === Comparison.EqualTo;
const jsFilePath = options.emitDeclarationOnly || isJsonEmittedToSameLocation ? undefined : ownOutputFilePath;
const sourceMapFilePath = !jsFilePath || isJsonSourceFile(sourceFile) ? undefined : getSourceMapFilePath(jsFilePath, options);
// For legacy reasons (ie, we have baselines capturing the behavior), js files don't report a .d.ts output path - this would only matter if `declaration` and `allowJs` were both on, which is currently an error
const isJs = isSourceFileJS(sourceFile);
Expand Down

This file was deleted.

0 comments on commit 9cda8d6

Please sign in to comment.