Skip to content
This repository was archived by the owner on Jul 13, 2020. It is now read-only.

Commit c999a22

Browse files
committed
Merge pull request #190 from matthewp/path-specificity
Make exact matches win for path lookup
2 parents bc590de + 541c51e commit c999a22

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/system.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,10 @@
235235

236236
// exact path match
237237
if (pathParts.length == 1) {
238-
if (name == p && p.length > pathMatch.length)
238+
if (name == p && p.length > pathMatch.length) {
239239
pathMatch = p;
240+
break;
241+
}
240242
}
241243

242244
// wildcard path match

test/test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,9 @@ function runTests() {
388388
});
389389

390390
test('Custom path most specific', function(assert) {
391+
delete System.paths['bar/*'];
391392
System.paths['bar/bar'] = 'loader/specific-path.js';
393+
System.paths['bar/*'] = 'loader/custom-folder/*.js';
392394
System['import']('bar/bar').then(function(m) {
393395
assert(m.path, true);
394396
});

0 commit comments

Comments
 (0)