FIX: `ember build` was not adding digests to additional bundles (#12703)

FIX: ember build was not adding digests to additional bundles (#12703)

  • FIX: ember build was not adding digests to additional bundles

  • Update app/assets/javascripts/discourse/ember-cli-build.js

Co-authored-by: Jarek Radosz jradosz@gmail.com

Co-authored-by: Jarek Radosz jradosz@gmail.com

diff --git a/app/assets/javascripts/discourse/ember-cli-build.js b/app/assets/javascripts/discourse/ember-cli-build.js
index bfeb055..5932ffa 100644
--- a/app/assets/javascripts/discourse/ember-cli-build.js
+++ b/app/assets/javascripts/discourse/ember-cli-build.js
@@ -8,6 +8,7 @@ const prettyTextEngine = require("./lib/pretty-text-engine");
 const { createI18nTree } = require("./lib/translation-plugin");
 const discourseScss = require("./lib/discourse-scss");
 const funnel = require("broccoli-funnel");
+const AssetRev = require("broccoli-asset-rev");
 
 module.exports = function (defaults) {
   let discourseRoot = resolve("../../../..");
@@ -20,6 +21,13 @@ module.exports = function (defaults) {
     },
   });
 
+  // Ember CLI does this by default for the app tree, but for our extra bundles we
+  // need to do it ourselves in production mode.
+  const isProduction = EmberApp.env().includes("production");
+  function digest(tree) {
+    return isProduction ? new AssetRev(tree) : tree;
+  }
+
   // WARNING: We should only import scripts here if they are not in NPM.
   // For example: our very specific version of bootstrap-modal.
   app.import(vendorJs + "bootbox.js");
@@ -37,9 +45,11 @@ module.exports = function (defaults) {
       files: ["highlight-test-bundle.min.js"],
       destDir: "assets/highlightjs",
     }),
-    concat(app.options.adminTree, {
-      outputFile: `assets/admin.js`,
-    }),
-    prettyTextEngine(vendorJs, "discourse-markdown"),
+    digest(
+      concat(app.options.adminTree, {
+        outputFile: `assets/admin.js`,
+      })
+    ),
+    digest(prettyTextEngine(vendorJs, "discourse-markdown")),
   ]);
 };

GitHub sha: 6a7a8f32

This commit appears in #12703 which was approved by CvX. It was merged by eviltrout.