From 5b2aa3bafe5c44d4c9babed57f3b4c5875c8c24b Mon Sep 17 00:00:00 2001 From: Yuping Zuo Date: Fri, 6 Sep 2019 17:05:14 +0800 Subject: [PATCH] fix(readfile): resolve relative path before require Close #183. --- lib/readfile.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/readfile.js b/lib/readfile.js index 98a63e7..be862fa 100644 --- a/lib/readfile.js +++ b/lib/readfile.js @@ -25,6 +25,9 @@ module.exports = function(file) { // JS / JSON / CoffeeScript if (ext.match(/json|js|coffee|ls/)) { + if (!path.isAbsolute(file)) { + file = path.join(process.cwd(), file) + } return require(file); }