Skip to content

Commit

Permalink
Temporary hack to fix terser output (#5461)
Browse files Browse the repository at this point in the history
  • Loading branch information
hsubox76 committed Sep 9, 2021
1 parent 66d4a1e commit dca28a1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/spicy-moose-approve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@firebase/firestore': patch
---

Temporary fix for a bug causing `initializeFirestore()` to not work with certain bundling pipelines.
14 changes: 13 additions & 1 deletion packages/firestore/rollup.shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,13 @@ 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.
// See issue: https://github.com/firebase/firebase-js-sdk/issues/5384
reserved: ['_getProvider'],
properties: {
regex: /^__PRIVATE_/,
// All JS Keywords are reserved. Although this should be taken cared of by
Expand Down Expand Up @@ -284,7 +291,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()
];
Expand Down

0 comments on commit dca28a1

Please sign in to comment.