From 238def7ec440d2e8ca2f94e114a3d774e945d229 Mon Sep 17 00:00:00 2001 From: Tim Addai Date: Wed, 11 Sep 2024 16:48:47 -0400 Subject: [PATCH] build: Disable merge_vars in Gruntfile uglify process `merge_vars` aggressively reuses variable names, which can lead to unexpected behavior or runtime errors in certain cases. It was introduced grunt-contrib-uglify 5.0.1 and it is now turned on by default. We are turning it off to ensure it does not break this project. --- Gruntfile.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Gruntfile.js b/Gruntfile.js index 7f994e4..900072c 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -106,7 +106,10 @@ module.exports = function(grunt) { sourceMap: DEBUG, sourceMapIncludeSources: DEBUG, mangle: !DEBUG, - compress: !DEBUG, + // Disable the `merge_vars` option in the compression phase. + // `merge_vars` aggressively reuses variable names, which can lead to + // unexpected behavior or runtime errors in certain cases. + compress: DEBUG ? false : { merge_vars: false }, // eslint-disable-line camelcase beautify: DEBUG, }, },