Skip to content

Commit

Permalink
Use settings if provided in isExternalModule and isExternalModuleMain
Browse files Browse the repository at this point in the history
  • Loading branch information
ombene committed Dec 22, 2021
1 parent 02c1dfb commit 105545b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/core/importType.js
Expand Up @@ -34,11 +34,11 @@ export function isExternalModule(name, settings, path, context) {
if (arguments.length < 4) {
throw new TypeError('isExternalModule: name, settings, path, and context are all required');
}
return (isModule(name) || isScoped(name)) && typeTest(name, context, path) === 'external';
return (isModule(name) || isScoped(name)) && typeTest(name, context, path, settings) === 'external';
}

export function isExternalModuleMain(name, settings, path, context) {
return isModuleMain(name) && typeTest(name, context, path) === 'external';
return isModuleMain(name) && typeTest(name, context, path, settings) === 'external';
}

const moduleRegExp = /^\w/;
Expand Down Expand Up @@ -106,8 +106,7 @@ function isExternalLookingName(name) {
return isModule(name) || isScoped(name);
}

function typeTest(name, context, path) {
const { settings } = context;
function typeTest(name, context, path, settings = context.settings) {
if (isInternalRegexMatch(name, settings)) { return 'internal'; }
if (isAbsolute(name, settings, path)) { return 'absolute'; }
if (isBuiltIn(name, settings, path)) { return 'builtin'; }
Expand Down

0 comments on commit 105545b

Please sign in to comment.