We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e9544f8 commit 651829dCopy full SHA for 651829d
3 files changed
src/core/importType.js
@@ -57,7 +57,8 @@ export function isScopedMain(name) {
57
}
58
59
function isInternalModule(name, settings, path) {
60
- return externalModuleRegExp.test(name) && !isExternalPath(path, name, settings)
+ const matchesScopedOrExternalRegExp = scopedRegExp.test(name) || externalModuleRegExp.test(name)
61
+ return (matchesScopedOrExternalRegExp && !isExternalPath(path, name, settings))
62
63
64
function isRelativeToParent(name) {
@@ -76,9 +77,9 @@ function isRelativeToSibling(name) {
76
77
const typeTest = cond([
78
[isAbsolute, constant('absolute')],
79
[isBuiltIn, constant('builtin')],
80
+ [isInternalModule, constant('internal')],
81
[isExternalModule, constant('external')],
82
[isScoped, constant('external')],
- [isInternalModule, constant('internal')],
83
[isRelativeToParent, constant('parent')],
84
[isIndex, constant('index')],
85
[isRelativeToSibling, constant('sibling')],
tests/files/@my-alias/fn.js
tests/src/core/importType.js
@@ -50,6 +50,11 @@ describe('importType(name)', function () {
50
const pathContext = testContext({ "import/resolver": { node: { paths: [ path.join(__dirname, '..', '..', 'files') ] } } })
51
expect(importType('@importType/index', pathContext)).to.equal('internal')
52
})
53
+
54
+ it("should return 'internal' for internal modules that are referenced by aliases", function () {
55
+ const pathContext = testContext({ 'import/resolver': { node: { paths: [path.join(__dirname, '..', '..', 'files')] } } })
56
+ expect(importType('@my-alias/fn', pathContext)).to.equal('internal')
+ })
it("should return 'parent' for internal modules that go through the parent", function() {
expect(importType('../foo', context)).to.equal('parent')
0 commit comments