DEV: Ensure that Discourse global is available for widget init (#15862)

Under ember-cli, we rely on the `ember-export-application-global` addon to make `window.Discourse` available. This happens in an initializer. Previously this inititalizer would run after `auto-load-modules`, and so any widget/helper modules would not be able to access it. This commit sets some `after` parameters on the `auto-load-modules` and `inject-objects` initializers to ensure that `export-application-global` is run first.
This commit is contained in:
David Taylor 2022-02-08 10:45:36 +00:00 committed by GitHub
parent ecc07fd8dc
commit 03b7d71827
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 0 deletions

View File

@ -36,5 +36,6 @@ export function autoLoadModules(container, registry) {
export default {
name: "auto-load-modules",
after: "inject-objects",
initialize: (container) => autoLoadModules(container, container.registry),
};

View File

@ -6,6 +6,7 @@ import deprecated from "discourse-common/lib/deprecated";
export default {
name: "inject-objects",
after: isLegacyEmber() ? null : "export-application-global",
initialize(container, app) {
// This is required for Ember CLI tests to work
setDefaultOwner(app.__container__);