Skip to content

Temporary hack to fix terser output #5461

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 9, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
13 changes: 12 additions & 1 deletion packages/firestore/rollup.shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably worth adding the issue link for future reference.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have two lists of reserved properties now (see right below - line 158). Do we know that this will work?

reserved: ['_getProvider'],
properties: {
regex: /^__PRIVATE_/,
// All JS Keywords are reserved. Although this should be taken cared of by
Expand Down Expand Up @@ -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()
];
Expand Down