Skip to content

Commit 8a1f7a4

Browse files
hsubox76dwyfrequency
authored andcommitted
Unmangle a switch variable for Closure (#7136)
1 parent b26c072 commit 8a1f7a4

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

packages/firebase/compat/rollup.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ import { emitModulePackageFile } from '../../../scripts/build/rollup_emit_module
3131

3232
const external = Object.keys(pkg.dependencies || {});
3333
const uglifyOptions = {
34-
mangle: true,
34+
mangle: {
35+
// Hack for a bug in Closure regarding switch block scope
36+
reserved: ['__PRIVATE_lastReasonableEscapeIndex']
37+
},
3538
webkit: true // Necessary to avoid https://bugs.webkit.org/show_bug.cgi?id=223533
3639
};
3740

packages/firestore/rollup.shared.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,10 @@ const manglePrivatePropertiesOptions = {
150150
// This can be removed if the problem in the downstream library is fixed
151151
// or if terser's mangler provides an option to avoid mangling everything
152152
// that isn't a property.
153+
// `lastReasonableEscapeIndex` was causing problems in a switch statement
154+
// due to a Closure bug.
153155
// See issue: https://github.com/firebase/firebase-js-sdk/issues/5384
154-
reserved: ['_getProvider'],
156+
reserved: ['_getProvider', '__PRIVATE_lastReasonableEscapeIndex'],
155157
properties: {
156158
regex: /^__PRIVATE_/,
157159
// All JS Keywords are reserved. Although this should be taken cared of by

0 commit comments

Comments
 (0)