Skip to content
This repository was archived by the owner on Nov 22, 2024. It is now read-only.

Commit a695e4f

Browse files
committed
fix(common): Debug Failure. False expression: node_modules/@types/node/ts3.2/index.d.ts linked to nonexistent file
Fixes: #1413
1 parent 55fd57e commit a695e4f

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

modules/common/schematics/add/index.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,12 +221,21 @@ function routingInitialNavigationRule(options: UniversalOptions): Rule {
221221
return host.read(fileName).toString().replace(/^\uFEFF/, '');
222222
};
223223
tsHost.directoryExists = function (directoryName: string): boolean {
224-
const dir = host.getDir(directoryName);
225-
return !!(dir.subdirs.length || dir.subfiles.length);
224+
// When the path is file getDir will throw.
225+
try {
226+
const dir = host.getDir(directoryName);
227+
228+
return !!(dir.subdirs.length || dir.subfiles.length);
229+
} catch {
230+
return false;
231+
}
226232
};
227233
tsHost.fileExists = function (fileName: string): boolean {
228234
return host.exists(fileName);
229235
};
236+
tsHost.realpath = function (path: string): string {
237+
return path;
238+
},
230239
tsHost.getCurrentDirectory = function () {
231240
return host.root.path;
232241
};

0 commit comments

Comments
 (0)