Skip to content
This repository was archived by the owner on Aug 4, 2021. It is now read-only.

Commit d892094

Browse files
author
Anike Arni
committed
Fix aliasing that matches entry file
1 parent 992ecaf commit d892094

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export default function alias(options = {}) {
5959
// First match is supposed to be the correct one
6060
const toReplace = aliasKeys.find(key => matches(key, importeeId));
6161

62-
if (!toReplace) {
62+
if (!toReplace || !importerId) {
6363
return null;
6464
}
6565

test/index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,16 @@ test('Absolute local aliasing', t => {
8787
t.is(resolved4, '/par/a/di/se.js');
8888
});
8989

90+
test('Leaves entry file untouched if matches alias', t => {
91+
const result = alias({
92+
abacaxi: './abacaxi',
93+
});
94+
95+
const resolved = result.resolveId('abacaxi/entry.js', undefined);
96+
97+
t.is(resolved, null);
98+
});
99+
90100
test('Test for the resolve property', t => {
91101
const result = alias({
92102
ember: './folder/hipster',

0 commit comments

Comments
 (0)