FIX: Allow deprecation to work with Ember CLI

FIX: Allow deprecation to work with Ember CLI

diff --git a/app/assets/javascripts/discourse/app/models/nav-item.js b/app/assets/javascripts/discourse/app/models/nav-item.js
index 412cd8e..955e536 100644
--- a/app/assets/javascripts/discourse/app/models/nav-item.js
+++ b/app/assets/javascripts/discourse/app/models/nav-item.js
@@ -273,12 +273,17 @@ export function addNavItem(item) {
   NavItem.extraNavItemDescriptors.push(item);
 }
 
-Object.defineProperty(Discourse, "NavItem", {
-  get() {
-    deprecated("Import the NavItem class instead of using Discourse.NavItem", {
-      since: "2.4.0",
-      dropFrom: "2.5.0"
-    });
-    return NavItem;
-  }
-});
+if (typeof Discourse !== "undefined") {
+  Object.defineProperty(Discourse, "NavItem", {
+    get() {
+      deprecated(
+        "Import the NavItem class instead of using Discourse.NavItem",
+        {
+          since: "2.4.0",
+          dropFrom: "2.5.0"
+        }
+      );
+      return NavItem;
+    }
+  });
+}

GitHub sha: 3062036f

1 Like