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

Fix and improve default export alias logic #3521

Merged
merged 4 commits into from Apr 29, 2020

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

Description

This will fix an issue in the logic that identified certain types of default exports, e.g. export default foo, with the variables they were exporting, e.g. foo. This caused wrong variable names and unnecessarily complex code in some cases.

@rollup-bot
Copy link
Collaborator

rollup-bot commented Apr 29, 2020

Thank you for your contribution! ❤️

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

npm install rollup/rollup#gh-3517-wrong-preserve-modules-variable-name

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

@codecov
Copy link

codecov bot commented Apr 29, 2020

Codecov Report

Merging #3521 into master will increase coverage by 0.09%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3521      +/-   ##
==========================================
+ Coverage   96.12%   96.22%   +0.09%     
==========================================
  Files         176      176              
  Lines        5984     5982       -2     
  Branches     1762     1763       +1     
==========================================
+ Hits         5752     5756       +4     
+ Misses        118      112       -6     
  Partials      114      114              
Impacted Files Coverage Δ
src/ast/variables/ExportDefaultVariable.ts 100.00% <ø> (+10.81%) ⬆️
src/Chunk.ts 99.77% <100.00%> (+<0.01%) ⬆️
src/Module.ts 98.90% <100.00%> (+0.02%) ⬆️
src/ast/nodes/ExportDefaultDeclaration.ts 100.00% <100.00%> (+3.44%) ⬆️
src/ast/variables/SyntheticNamedExportVariable.ts 92.85% <100.00%> (+0.54%) ⬆️

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 8db16bd...6fda3b1. Read the comment docs.

@lukastaegert lukastaegert force-pushed the gh-3517-wrong-preserve-modules-variable-name branch from 6a501af to c513681 Compare April 29, 2020 18:35
@lukastaegert lukastaegert force-pushed the gh-3517-wrong-preserve-modules-variable-name branch from c513681 to 6fda3b1 Compare April 29, 2020 18:44
@lukastaegert lukastaegert merged commit e4f4d6a into master Apr 29, 2020
@lukastaegert lukastaegert deleted the gh-3517-wrong-preserve-modules-variable-name branch April 29, 2020 18:50
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.

preserveModules uses wrong variable names when targeting CJS
2 participants