diff --git a/index.cjs b/index.cjs new file mode 100644 index 0000000..b07d6db --- /dev/null +++ b/index.cjs @@ -0,0 +1,8 @@ +const fs = require('fs'); + +const fsExists = async filePath => fs.promises.access( + filePath, + fs.constants.F_OK, +).then(() => true, () => false); + +module.exports = fsExists; diff --git a/package.json b/package.json index e60d17e..ab42385 100644 --- a/package.json +++ b/package.json @@ -17,10 +17,14 @@ }, "type": "module", "files": [ + "index.cjs", "index.js", "index.d.ts" ], - "exports": "./index.js", + "exports": { + "import": "./index.js", + "require": "./index.cjs" + }, "scripts": { "build": "tsc", "lint": "eslint .",