From 6c23b3e035b3f173fc97c9d371ab96b8aa21221a Mon Sep 17 00:00:00 2001 From: Jelle De Loecker Date: Sat, 18 May 2024 14:53:25 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Don't=20depropertize=20certain?= =?UTF-8?q?=20`Blast`=20properties?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/server_functions.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/server_functions.js b/lib/server_functions.js index 2a44629..38b4ece 100644 --- a/lib/server_functions.js +++ b/lib/server_functions.js @@ -1436,6 +1436,23 @@ module.exports = function serverFunctions(Blast, extras) { } } + let var_name = tokens[i - 2]; + + // Ignore the `Blast.` properties, + // or they can't be used in Terser's `global_defs` option + if (var_name == 'Blast') { + switch (token) { + case 'isBrowser': + case 'isServer': + case 'isNode': + case 'environment': + case 'isProduction': + case 'isDevelopment': + case 'isStaging': + continue; + } + } + if (!is_string) { token = "'" + token + "'"; } else if (first_char == '"' && !token.includes("'")) {