From 4aad1845eeb666ee1054eccc1a3976ff82113229 Mon Sep 17 00:00:00 2001 From: khoaHyh Date: Wed, 24 Jan 2024 13:02:28 -0500 Subject: [PATCH] refactor: remove path.resolve() - require.resolve() by Node.js follows a Node.js module resolution algo which includes checking if the resolved path actually exists on the file system. --- lib/cli/collect-files.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/cli/collect-files.js b/lib/cli/collect-files.js index c24fbbe42e..e5ae32486a 100644 --- a/lib/cli/collect-files.js +++ b/lib/cli/collect-files.js @@ -54,9 +54,8 @@ module.exports = ({ }, []); fileArgs.forEach(file => { - const fileAbsolutePath = path.resolve(file); try { - require.resolve(fileAbsolutePath); + require.resolve(file); } catch (err) { // this error doesn't bubble up to the middleware like how // --require handles it so we have to do it here