From 5b8c46a92cfafb46146fc3d2daaa0c399f856509 Mon Sep 17 00:00:00 2001 From: Roman Kinyakin <1@grep.su> Date: Thu, 23 May 2019 19:35:54 +0600 Subject: [PATCH] Fix webpack build issue When bundling with webpack, it throws an error on `path.dirname`, because `require.main` does not have a `filename`. --- lib/resolve.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/resolve.js b/lib/resolve.js index 2e9b8d5..bceadfc 100644 --- a/lib/resolve.js +++ b/lib/resolve.js @@ -79,7 +79,7 @@ module.exports = function resolve(dirname) { // If the above didn't work, or this module is loaded globally, then // resort to require.main.filename (See http://nodejs.org/api/modules.html) if (alternateMethod || null == appRootPath) { - appRootPath = path.dirname(require.main.filename); + appRootPath = path.dirname(requireFunction.main.filename); } // Handle global bin/ directory edge-case