From 5d71b222bada07c52361a89d55d2f681f8c1f22c Mon Sep 17 00:00:00 2001 From: Christina Holland Date: Wed, 8 Sep 2021 16:44:02 -0700 Subject: [PATCH 1/3] Hack fix for terser problem --- packages/firestore/rollup.shared.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/firestore/rollup.shared.js b/packages/firestore/rollup.shared.js index 464cc633980..bb9c2070208 100644 --- a/packages/firestore/rollup.shared.js +++ b/packages/firestore/rollup.shared.js @@ -145,6 +145,12 @@ const manglePrivatePropertiesOptions = { beautify: true }, mangle: { + // Temporary hack fix for an issue where mangled code causes some downstream + // bundlers (Babel?) to confuse the same variable name in different scopes. + // This can be removed if the problem in the downstream library is fixed + // or if terser's mangler provides an option to avoid mangling everything + // that isn't a property. + reserved: ['_getProvider'], properties: { regex: /^__PRIVATE_/, // All JS Keywords are reserved. Although this should be taken cared of by @@ -284,7 +290,12 @@ exports.es2017ToEs5Plugins = function (mangled = false) { comments: 'all', beautify: true }, - mangle: true + // See comment above `manglePrivatePropertiesOptions`. This build did + // not have the identical variable name issue but we should be + // consistent. + mangle: { + reserved: ['_getProvider'] + } }), sourcemaps() ]; From b939c89ccbaa95a01b01e3a005f59e317eb74a30 Mon Sep 17 00:00:00 2001 From: Christina Holland Date: Wed, 8 Sep 2021 16:45:16 -0700 Subject: [PATCH 2/3] Add changeset --- .changeset/spicy-moose-approve.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/spicy-moose-approve.md diff --git a/.changeset/spicy-moose-approve.md b/.changeset/spicy-moose-approve.md new file mode 100644 index 00000000000..be7b7e5013b --- /dev/null +++ b/.changeset/spicy-moose-approve.md @@ -0,0 +1,5 @@ +--- +'@firebase/firestore': patch +--- + +Temporary fix for a bug causing `initializeFirestore()` to not work with certain bundling pipelines. From 78fab005006e33120a7527efd1b7b7f01ac8bcbd Mon Sep 17 00:00:00 2001 From: Christina Holland Date: Wed, 8 Sep 2021 17:22:58 -0700 Subject: [PATCH 3/3] Add issue to comment --- packages/firestore/rollup.shared.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/firestore/rollup.shared.js b/packages/firestore/rollup.shared.js index bb9c2070208..3f31e3061ed 100644 --- a/packages/firestore/rollup.shared.js +++ b/packages/firestore/rollup.shared.js @@ -150,6 +150,7 @@ const manglePrivatePropertiesOptions = { // This can be removed if the problem in the downstream library is fixed // or if terser's mangler provides an option to avoid mangling everything // that isn't a property. + // See issue: https://github.com/firebase/firebase-js-sdk/issues/5384 reserved: ['_getProvider'], properties: { regex: /^__PRIVATE_/,