From aeab029a157d24bf3ed86917e9ac01a5e6d03f1b Mon Sep 17 00:00:00 2001 From: Gerrit Birkeland Date: Sun, 12 Jan 2020 10:31:39 -0700 Subject: [PATCH] fix: Catch error in expandInputFiles Closes #751 Co-Authored-By: Tim Sawyer --- src/lib/application.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/lib/application.ts b/src/lib/application.ts index 87e9982db..53109636c 100644 --- a/src/lib/application.ts +++ b/src/lib/application.ts @@ -305,8 +305,15 @@ export class Application extends ChildableComponent< const supportedFileRegex = this.options.getCompilerOptions().allowJs ? /\.[tj]sx?$/ : /\.tsx?$/; function add(file: string, entryPoint: boolean) { - const fileIsDir = FS.statSync(file).isDirectory(); - if (fileIsDir && file.slice(-1) !== '/') { + let stats: FS.Stats; + try { + stats = FS.statSync(file); + } catch { + // No permission or a symbolic link, do not resolve. + return; + } + const fileIsDir = stats.isDirectory(); + if (fileIsDir && !file.endsWith('/')) { file = `${file}/`; }