From bb941cc85013a3627e57eaef70af20700555fdc6 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Wed, 15 Nov 2023 15:20:32 +0000 Subject: [PATCH] DEV: Apply raw-hbs compilation via ember-cli-build.js (#24384) Previously, the discourse-hbr plugin took the entire app tree as its input, and the result would then be merged into the app. This is wasteful and more likely to cause problems in the build pipeline. See also https://github.com/discourse/discourse/pull/24376 --- app/assets/javascripts/discourse-hbr/index.js | 6 ------ app/assets/javascripts/discourse/ember-cli-build.js | 5 +++++ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/discourse-hbr/index.js b/app/assets/javascripts/discourse-hbr/index.js index 6747915863e..c5dd687c47c 100644 --- a/app/assets/javascripts/discourse-hbr/index.js +++ b/app/assets/javascripts/discourse-hbr/index.js @@ -1,11 +1,5 @@ "use strict"; -const rawHandlebarsCompiler = require("./raw-handlebars-compiler"); - module.exports = { name: require("./package").name, - - treeForApp() { - return rawHandlebarsCompiler(this.app.trees.app); - }, }; diff --git a/app/assets/javascripts/discourse/ember-cli-build.js b/app/assets/javascripts/discourse/ember-cli-build.js index 835eac36438..9409954096f 100644 --- a/app/assets/javascripts/discourse/ember-cli-build.js +++ b/app/assets/javascripts/discourse/ember-cli-build.js @@ -14,6 +14,7 @@ const generateWorkboxTree = require("./lib/workbox-tree-builder"); const { compatBuild } = require("@embroider/compat"); const { Webpack } = require("@embroider/webpack"); const { StatsWriterPlugin } = require("webpack-stats-plugin"); +const RawHandlebarsCompiler = require("discourse-hbr/raw-handlebars-compiler"); process.env.BROCCOLI_ENABLED_MEMOIZE = true; @@ -72,6 +73,10 @@ module.exports = function (defaults) { }, historySupportMiddleware: false, + + trees: { + app: RawHandlebarsCompiler("app"), + }, }); // TODO: remove me