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

Provide synthetic namespace for dynamic imports when perserving modules #4913

Merged
merged 2 commits into from Mar 20, 2023

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:

Description

When dynamically importing a module with a synthetic namespace, we always need a pre-created dynamic namespace object. This was conflicting with the logic to prevent such objects when preserving modules.
The solution here is to still create these objects for this exact scenario, even if it means adding an additional export to the module.

@github-actions
Copy link

github-actions bot commented Mar 19, 2023

Thank you for your contribution! ❤️

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

npm install rollup/rollup#gh-4905-dynamic-import-synthetic

or load it into the REPL:
https://deploy-preview-4913--rollupjs.netlify.app/repl/?pr=4913

@codecov
Copy link

codecov bot commented Mar 19, 2023

Codecov Report

Merging #4913 (de92929) into master (3682f30) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #4913      +/-   ##
==========================================
- Coverage   99.01%   99.01%   -0.01%     
==========================================
  Files         221      221              
  Lines        8030     8029       -1     
  Branches     2211     2210       -1     
==========================================
- Hits         7951     7950       -1     
  Misses         26       26              
  Partials       53       53              
Impacted Files Coverage Δ
src/Chunk.ts 99.65% <100.00%> (-0.01%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@lukastaegert lukastaegert merged commit eb9777c into master Mar 20, 2023
14 checks passed
@lukastaegert lukastaegert deleted the gh-4905-dynamic-import-synthetic branch March 20, 2023 05:30
@rollup-bot
Copy link
Collaborator

This PR has been released as part of rollup@3.20.0. You can test it via npm install rollup.

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