From 8163b6f954533e3a4c467d09568bd2e1d34a1fe2 Mon Sep 17 00:00:00 2001 From: Mark Hicken Date: Fri, 22 Mar 2019 17:12:09 -0600 Subject: [PATCH] Support globs inside a node module folder - https://github.com/devongovett/babel-plugin-transform-glob-import/issues/1 --- index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/index.js b/index.js index 30a746b..29c7117 100644 --- a/index.js +++ b/index.js @@ -55,6 +55,10 @@ module.exports = function ({types: t}) { } let files = glob.sync(pattern, {strict: true, nodir: true}); + if (files.length === 0) { + pattern = 'node_modules/' + path.node.source.value; + files = glob.sync(pattern, {strict: true, nodir: true}); + } // Capture matches let re = micromatch.makeRe(pattern, {capture: true});