diff --git a/src/index.ts b/src/index.ts index 195148b..91620af 100644 --- a/src/index.ts +++ b/src/index.ts @@ -243,8 +243,9 @@ function removeQuerystring(id: string) { const isFile = (path?: string | undefined): path is string => { try { - return !!path && fs.statSync(path).isFile() + return (path && fs.statSync(path, { throwIfNoEntry: false })?.isFile()) || false; } catch { + // Node 12 does not support throwIfNoEntry. return false } } @@ -331,8 +332,8 @@ function initMappers(options: InternalResolverOptions) { typeof options.project === 'string' ? [options.project] : Array.isArray(options.project) - ? options.project - : [process.cwd()] + ? options.project + : [process.cwd()] const ignore = ['!**/node_modules/**']