From: Alexander Ebert Date: Thu, 27 Jan 2022 18:53:06 +0000 (+0100) Subject: Properly remove lazy-loaded modules from the bundle X-Git-Tag: 5.5.0_Alpha_1~181^2~2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6052240e86e95e0c36b6759a428e649cac1604cd;p=GitHub%2FWoltLab%2FWCF.git Properly remove lazy-loaded modules from the bundle --- diff --git a/wcfsetup/install/files/js/require.build.js b/wcfsetup/install/files/js/require.build.js index cbec15a255..6b2cd55384 100644 --- a/wcfsetup/install/files/js/require.build.js +++ b/wcfsetup/install/files/js/require.build.js @@ -1,4 +1,6 @@ (function () { + const excludedModules = []; + var config = { mainConfigFile: 'require.config.js', generateSourceMaps: true, @@ -69,6 +71,7 @@ if ((matches = contents.match(/@woltlabExcludeBundle\s+(tiny|all)/))) { switch (matches[1]) { case 'all': + excludedModules.push(module.replace(/\.js$/, '')); return false; case 'tiny': return moduleName !== 'WoltLabSuite.Core.tiny.min'; @@ -84,7 +87,14 @@ } return moduleContents; - } + }, + onBuildWrite(moduleName, path, contents) { + if (excludedModules.includes(moduleName)) { + return ""; + } + + return contents; + }, }; var _isSupportedBuildUrl = require._isSupportedBuildUrl;