PERF: Only apply terser to production assets (#24699)

We funnel vendored javascript through ember-cli, but that's only used for the testem environment. Therefore, there's no need to minify it in production builds. In my tests, this reduces peak RSS of a production build from 3.53GB to 3.15GB.
This commit is contained in:
David Taylor 2023-12-04 18:05:55 +00:00 committed by GitHub
parent c4381e0265
commit 87d850948f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 11 deletions

View File

@ -141,16 +141,20 @@ module.exports = function (defaults) {
parsePluginClientSettings(discourseRoot, vendorJs, app),
funnel(`${discourseRoot}/public/javascripts`, { destDir: "javascripts" }),
generateWorkboxTree(),
concat(adminTree, {
inputFiles: ["**/*.js"],
outputFile: `assets/admin.js`,
}),
concat(wizardTree, {
inputFiles: ["**/*.js"],
outputFile: `assets/wizard.js`,
}),
generateScriptsTree(app),
discoursePluginsTree,
applyTerser(
concat(adminTree, {
inputFiles: ["**/*.js"],
outputFile: `assets/admin.js`,
})
),
applyTerser(
concat(wizardTree, {
inputFiles: ["**/*.js"],
outputFile: `assets/wizard.js`,
})
),
applyTerser(generateScriptsTree(app)),
applyTerser(discoursePluginsTree),
testStylesheetTree,
];
@ -261,5 +265,5 @@ module.exports = function (defaults) {
},
});
return mergeTrees([appTree, applyTerser(mergeTrees(extraPublicTrees))]);
return mergeTrees([appTree, mergeTrees(extraPublicTrees)]);
};