Skip to content

Commit

Permalink
Merge pull request #588 from snewcomer/sn/resolve-main
Browse files Browse the repository at this point in the history
Ensure `app/foo/index.js` can be looked up with `foo:main`
  • Loading branch information
rwjblue committed Aug 7, 2020
2 parents 593a1b0 + 9fae5ba commit 201903f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion addon/resolvers/classic/index.js
Expand Up @@ -19,7 +19,7 @@ export class ModuleRegistry {
return Object.keys(this._entries);
}
has(moduleName) {
return moduleName in this._entries;
return require.has(moduleName);
}
get(moduleName) {
return require(moduleName);
Expand Down
11 changes: 11 additions & 0 deletions tests/unit/resolvers/classic/basic-test.js
Expand Up @@ -386,6 +386,17 @@ test("store:main is looked up as prefix/store", function(assert) {
resolver.resolve('store:main');
});

test("store:main is looked up as prefix/store/index.js", function(assert) {
assert.expect(1);

define('appkit/store/index', [], function(){
assert.ok(true, 'store:main was looked up');
return 'whatever';
});

resolver.resolve('store:main');
});

test("store:posts as prefix/stores/post", function(assert) {
assert.expect(1);

Expand Down

0 comments on commit 201903f

Please sign in to comment.