diff --git a/packages/node-resolve/src/fs.js b/packages/node-resolve/src/fs.js index 11fa93067..76831c3f0 100644 --- a/packages/node-resolve/src/fs.js +++ b/packages/node-resolve/src/fs.js @@ -2,8 +2,15 @@ import fs from 'fs'; import { promisify } from 'util'; -export const exists = promisify(fs.exists); export const readFile = promisify(fs.readFile); export const realpath = promisify(fs.realpath); export { realpathSync } from 'fs'; export const stat = promisify(fs.stat); +export async function exists() { + try { + await stat(filePath); + return true; + } catch { + return false; + } +}