Skip to content

Commit 5b4ae9c

Browse files
committed
Fix alias resolution and extension adding not working together
1 parent 37f513e commit 5b4ae9c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ const createModuleResolverPreprocessor = (karmaConfig, args = {}, config = {}, l
3737
result += '.' + options.addExtension;
3838
}
3939

40-
if (!isLocalPath(modulePath)) {
40+
if (!isLocalPath(result)) {
4141
for (const alias of sortedAliases) {
42-
if (modulePath.startsWith(alias)) {
43-
const pathUnderAlias = path.relative(alias, modulePath);
42+
if (result.startsWith(alias)) {
43+
const pathUnderAlias = path.relative(alias, result);
4444
const fullImportPath = path.resolve(options.aliases[alias], pathUnderAlias);
4545

46-
result = path.relative(path. dirname(file.path), fullImportPath);
46+
result = path.relative(path.dirname(file.path), fullImportPath);
4747
if (!isLocalPath(result)) {
4848
result = './' + result;
4949
}

0 commit comments

Comments
 (0)