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

Include side effects of re-exporters unless they have no moduleSideEffects #4867

Merged
merged 2 commits into from
Feb 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

If a module with moduleSideEffects:false is reexporting from a module with moduleSideEffects:true that again is reexporting from another file, currently neither side effects in the first reexporter nor in the second reexporter are included.

As this defeats expectations of many, this PR changes the logic so that in this case, side effects of the reexporter with moduleSideEffects:true ARE indeed included, hopefully solving the issues that many people had.

Note that as before, side effects are always included if the module does not use a reexport but rather imports the value and then directly exports it, independent of the moduleSideEffects value.

@netlify
Copy link

netlify bot commented Feb 19, 2023

Deploy Preview for rollupjs ready!

Name Link
🔨 Latest commit 5ab4841
🔍 Latest deploy log https://app.netlify.com/sites/rollupjs/deploys/63f304b1d683d00008b2b0bd
😎 Deploy Preview https://deploy-preview-4867--rollupjs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@github-actions
Copy link

github-actions bot commented Feb 19, 2023

Thank you for your contribution! ❤️

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

npm install rollup/rollup#module-side-effects-reexport

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

@codecov
Copy link

codecov bot commented Feb 19, 2023

Codecov Report

Merging #4867 (5ab4841) into master (eb57f5f) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #4867   +/-   ##
=======================================
  Coverage   98.98%   98.98%           
=======================================
  Files         219      219           
  Lines        7943     7945    +2     
  Branches     2188     2189    +1     
=======================================
+ Hits         7862     7864    +2     
  Misses         26       26           
  Partials       55       55           
Impacted Files Coverage Δ
src/Module.ts 100.00% <100.00%> (ø)

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 47061d8 into master Feb 20, 2023
@lukastaegert lukastaegert deleted the module-side-effects-reexport branch February 20, 2023 05:38
@rollup-bot
Copy link
Collaborator

This PR has been released as part of rollup@3.17.2. 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