-
Notifications
You must be signed in to change notification settings - Fork 927
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
Conversation
🦋 Changeset detectedLatest commit: 78fab00 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
// 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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added.
There was a problem hiding this comment.
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?
Mangled terser code is causing some problems seen in Create React App apps. This is a temporary fix that will avoid mangling the specific variable in question. Long term fix is to see if terser will provide an option to mangle properties without mangling anything else (currently not available), and/or find out what downstream build tool is causing this bug and get them to fix it.
Details:
The
initializeFirestore()
function, when mangled by terser, has two variables with the same name in different scopes (one is an import, one is aconst
in anif
block). This seems to confuse one of the tools in the Create React App production default build pipeline (Babel?). The code is converted to ES5, which makes theconst
avar
, which puts both variables sharing a name into the same scope. The build tool gets confused and does not convert the import to the correct symbol, thinking it is the same as the declaredvar
. We should try to pinpoint what step of the build this happens in and report a bug to the appropriate library.Fixes #5384