console/patches/@oclif__core@1.23.0.patch

21 lines
837 B
Diff
Raw Normal View History

diff --git a/lib/module-loader.js b/lib/module-loader.js
index acb43adf1747c928199fffef48418e9833dd8843..64753c3babf4940bdef31c926614e956ca9d31d5 100644
--- a/lib/module-loader.js
+++ b/lib/module-loader.js
@@ -124,7 +124,15 @@ class ModuleLoader {
let isESM;
let filePath;
try {
- filePath = require.resolve(modulePath);
+ try {
+ filePath = require.resolve(modulePath);
+ } catch (error) {
+ const customPath = process.env.OCLIF_CLI_CUSTOM_PATH;
+ if (typeof customPath !== 'string') {
+ throw error;
+ }
+ filePath = require.resolve(path.resolve(customPath, modulePath) + '.js');
+ }
isESM = ModuleLoader.isPathModule(filePath);
}
catch {