mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Support components under /index paths in themes/plugins (#23876)
Normally, modules defined under `blah/index` can be imported as `blah`. This is also true of Ember resolver lookups - `<MyComponent />` should resolve to the same as `<MyComponent::Index />`. This was working as expected in Discourse core, but we had not implemented the same in our custom resolver logic for themes/plugins. This commit implements the `/index` fallback, and adds a test for the behaviour.
This commit is contained in:
@@ -147,7 +147,14 @@ function lookupModuleBySuffix(suffix) {
|
||||
}
|
||||
});
|
||||
}
|
||||
return moduleSuffixTrie.withSuffix(suffix, 1)[0];
|
||||
return (
|
||||
moduleSuffixTrie.withSuffix(suffix, 1)[0] ||
|
||||
moduleSuffixTrie.withSuffix(`${suffix}/index`, 1)[0]
|
||||
);
|
||||
}
|
||||
|
||||
export function expireModuleTrieCache() {
|
||||
moduleSuffixTrie = null;
|
||||
}
|
||||
|
||||
export function buildResolver(baseName) {
|
||||
|
||||
Reference in New Issue
Block a user