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

Always create a dynamic namespace object when a module with synthetic named exports is imported dynamically #3648

Merged

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 rollup/plugins#467

Description

Unfortunately until now, dynamically importing a module with synthetic named exports only returned a "regular" namespace that did not contain properties of the default export. This PR fixes this by always forcing the creation of a proper namespace object in these situations that contains both the named exports and the properties of the default export and returning this when a dynamic import is used.

@rollup-bot
Copy link
Collaborator

rollup-bot commented Jun 26, 2020

Thank you for your contribution! ❤️

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

npm install rollup/rollup#gh-plugins-467-dynamic-import-synthetic-exports

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

@codecov
Copy link

codecov bot commented Jun 26, 2020

Codecov Report

Merging #3648 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3648   +/-   ##
=======================================
  Coverage   96.70%   96.70%           
=======================================
  Files         183      183           
  Lines        6274     6278    +4     
  Branches     1827     1829    +2     
=======================================
+ Hits         6067     6071    +4     
  Misses        105      105           
  Partials      102      102           
Impacted Files Coverage Δ
src/Module.ts 100.00% <ø> (ø)
src/Chunk.ts 100.00% <100.00%> (ø)
src/ast/nodes/ImportExpression.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 ee6ef99...89436e5. Read the comment docs.

@lukastaegert lukastaegert force-pushed the gh-plugins-467-dynamic-import-synthetic-exports branch from 8173e69 to 89436e5 Compare June 26, 2020 19:17
@lukastaegert lukastaegert merged commit 981b11c into master Jun 26, 2020
@lukastaegert lukastaegert deleted the gh-plugins-467-dynamic-import-synthetic-exports branch June 26, 2020 19:22
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.

[commonjs] named export missing with v13 + dynamic imports
2 participants