diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index f930ce295fb..ea858e21fbf 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -611,7 +611,7 @@ namespace ts { const originalWriteFile = sys.writeFile; sys.writeFile = function(path, data, writeBom) { const directoryPath = getDirectoryPath(normalizeSlashes(path)); - if (!sys.directoryExists(directoryPath)) { + if (directoryPath && !sys.directoryExists(directoryPath)) { recursiveCreateDirectory(directoryPath, sys); } originalWriteFile.call(sys, path, data, writeBom);