Skip to content
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

Avoid conflicts with local variables named Symbol, Object, Promise #3971

Merged
merged 1 commit into from Feb 23, 2021

Conversation

lukastaegert
Copy link
Member

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes (bugfixes and features will not be merged without tests)
  • no

Breaking Changes?

  • yes (breaking changes will not be merged unless absolutely necessary)
  • no

List any relevant issue numbers:
Resolves #3969

Description

For various features, Rollup relies on the global variables Symbol, Object and Promise working as intended. This can break if a module declares a variable of the same name in its top-level scope. This PR fixes it by making sure these names are always treated as reserved so that local variables are renamed if necessary.

@rollup-bot
Copy link
Collaborator

Thank you for your contribution! ❤️

You can try out this pull request locally by installing Rollup via

npm install rollup/rollup#gh-3969_avoid_builtin_conflicts

or load it into the REPL:
https://rollupjs.org/repl/?circleci=14329

@codecov
Copy link

codecov bot commented Feb 23, 2021

Codecov Report

Merging #3971 (e05babf) into master (f3b1c81) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3971   +/-   ##
=======================================
  Coverage   97.21%   97.21%           
=======================================
  Files         191      191           
  Lines        6704     6706    +2     
  Branches     1960     1961    +1     
=======================================
+ Hits         6517     6519    +2     
  Misses         99       99           
  Partials       88       88           
Impacted Files Coverage Δ
src/Chunk.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f3b1c81...e05babf. Read the comment docs.

@lukastaegert lukastaegert merged commit a14cbb1 into master Feb 23, 2021
@lukastaegert lukastaegert deleted the gh-3969_avoid_builtin_conflicts branch February 23, 2021 05:31
@bva-mike
Copy link

bva-mike commented Mar 2, 2021

Is it possible to add to this list of local variables? As i'm currently getting this issue : zloirock/core-js#587

This was referenced Mar 6, 2021
This was referenced Mar 15, 2021
@lukastaegert
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Declaring Symbol variable conflicts with namespaceToStringTag
3 participants