From 44de0cc8d74b25a08aa6a12d59e700ad0cfa7e17 Mon Sep 17 00:00:00 2001 From: Tony Kovanen Date: Wed, 6 Apr 2016 23:13:20 +0300 Subject: [PATCH] If file not found at all, don't attempt to list it Like the automatically generated `index.js` main from `npm init` if it's actually not there. --- lib/get-files.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/get-files.js b/lib/get-files.js index 37d5692..cf54b64 100644 --- a/lib/get-files.js +++ b/lib/get-files.js @@ -126,7 +126,12 @@ const explode = async function (paths, ignored, { limit, debug }) { // in case the file comes from `files` or `main` // and it wasn't specified with `.js` by the user path = file + '.js'; - s = await stat(path); + + try { + s = await stat(path); + } catch (e2) { + return null; + } } if (isIgnored(file, ignored)) {