FEATURE: Deprecate lodash so we can remove it.

FEATURE: Deprecate lodash so we can remove it.

It’s currently 240k of Javascript we don’t need anymore. It’s been replaced by ES6 and a couple helper functions.

diff --git a/app/assets/javascripts/discourse/app/pre-initializers/discourse-bootstrap.js b/app/assets/javascripts/discourse/app/pre-initializers/discourse-bootstrap.js
index 15b9ef8..1144880 100644
--- a/app/assets/javascripts/discourse/app/pre-initializers/discourse-bootstrap.js
+++ b/app/assets/javascripts/discourse/app/pre-initializers/discourse-bootstrap.js
@@ -125,5 +125,23 @@ export default {
 
       window.onerror(e && e.message, null, null, null, e);
     });
+
+    // Deprecate lodash usage
+    let lo = window._;
+    if (lo) {
+      Object.keys(lo).forEach(m => {
+        let old = lo[m];
+        lo[m] = function() {
+          deprecated(
+            `lodash is deprecated and will be removed from Discourse.`,
+            {
+              since: "2.6",
+              dropFrom: "2.7"
+            }
+          );
+          return old(...arguments);
+        };
+      });
+    }
   }
 };

GitHub sha: 8c0f1879

1 Like

This commit appears in #10566 which was merged by eviltrout.