DEV: Restore ember-global deprecation in production (#24664)

Even with our patch to the deprecate() macro, this is optimized out of the production build because it's wrapped in an `if(DEBUG)` statement. (https://github.com/davidtaylorhq/ember.js/blob/14c02f53b8/packages/%40ember/-internals/bootstrap/index.ts#L19-L19)
This commit is contained in:
David Taylor 2023-12-01 13:07:57 +00:00 committed by GitHub
parent ecf7a4f0c6
commit 106c1c317f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,6 +33,29 @@ define("discourse/lib/deprecate-shim", ["exports"], function (exports) {
console.warn(`DEPRECATION: ${updatedMessage}`);
}
);
// Patch ember-global deprecation
Object.defineProperty(window, "Ember", {
enumerable: true,
configurable: true,
get() {
require("@ember/debug").deprecate(
"Usage of the Ember Global is deprecated. You should import the Ember module or the specific API instead.",
false,
{
id: "ember-global",
until: "4.0.0",
url: "https://deprecations.emberjs.com/v3.x/#toc_ember-global",
for: "ember-source",
since: {
enabled: "3.27.0",
},
}
);
return require("ember").default;
},
});
};
});