File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -485,7 +485,10 @@ namespace ts {
485485 // Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
486486 // (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
487487 let options : any ;
488- if ( ! directoryExists ( directoryName ) ) {
488+ if ( ! directoryExists ( directoryName ) || ( isUNCPath ( directoryName ) && process . platform === "win32" ) ) {
489+ // do nothing if either
490+ // - target folder does not exist
491+ // - this is UNC path on Windows (https://github.com/Microsoft/TypeScript/issues/13874)
489492 return noOpFileWatcher ;
490493 }
491494
@@ -509,6 +512,10 @@ namespace ts {
509512 } ;
510513 }
511514 ) ;
515+
516+ function isUNCPath ( s : string ) : boolean {
517+ return s . length > 2 && s . charCodeAt ( 0 ) === CharacterCodes . slash && s . charCodeAt ( 1 ) === CharacterCodes . slash ;
518+ }
512519 } ,
513520 resolvePath : function ( path : string ) : string {
514521 return _path . resolve ( path ) ;
You can’t perform that action at this time.
0 commit comments