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

Properly deduplicate reexported default exports #2866

Merged
merged 4 commits into from May 19, 2019

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 #2865

Description

Default exports are tricky as they technically define new variables but can be simplified to existing variables in case an existing variable is default exported—as long as this variable is not reassigned. This logic already caused issues in the past and recently caused #2865 because past fixes did not take into account that variables could be default exported over several stages.

This PR fixes this by adding a general solution to find the best variable to represent a default export, avoiding cases where a chunk imports the same binding under different names and assigns them to the same name.

This will NOT remove duplicate exports of the same binding from a chunk. The reason is that in case the chunk is a static or dynamic entry point, we cannot just remove exports and in all other cases, some additional logic would be necessary to determine which exports are the unused ones.

@lukastaegert lukastaegert merged commit 9f84980 into master May 19, 2019
@lukastaegert lukastaegert deleted the handle-reexported-default-exports branch May 19, 2019 09:34
@manucorporat
Copy link
Contributor

Thanks a lot for the fix as usual!

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.

Duplicated identifier when reexporting default
2 participants