From 6dd21459a7c0608e8fafa2e2d29c4096d38a5271 Mon Sep 17 00:00:00 2001 From: Anthony Powers Date: Mon, 17 May 2021 12:28:01 -0700 Subject: [PATCH] Match against "pattern*" as RegExp --- utils/resolve.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/utils/resolve.js b/utils/resolve.js index ea5bf5a150..3cbe3b4483 100644 --- a/utils/resolve.js +++ b/utils/resolve.js @@ -87,7 +87,12 @@ function relative(modulePath, sourceFile, settings) { function fullResolve(modulePath, sourceFile, settings) { // check if this is a bonus core module const coreSet = new Set(settings['import/core-modules']); - if (coreSet.has(modulePath)) return { found: true, path: null }; + if (coreSet.some(c => { + const regex = new RegExp(`^${c.slice(-1) === '*' ? c.replaceFirst('.$', '.*') : c}$`); + return regex.test(modulePath); + })) { + return { found: true, path: null }; + } const sourceDir = path.dirname(sourceFile); const cacheKey = sourceDir + hashObject(settings).digest('hex') + modulePath;