build(rollup-utils): Skip bare side-effect imports for sideEffects: false externals - #23674
Open
JPeer264 wants to merge 1 commit into
Open
build(rollup-utils): Skip bare side-effect imports for sideEffects: false externals#23674JPeer264 wants to merge 1 commit into
sideEffects: false externals#23674JPeer264 wants to merge 1 commit into
Conversation
…false` externals Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
size-limit report 📦
|
Lms24
approved these changes
Aug 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For CF integration tests there were a lot of warnings printed:
Root cause
treeshake.moduleSideEffectsindev-packages/rollup-utils/npmHelpers.mjstold Rollup that every external module has side effects. When Rollup tree-shakes away all named bindings of such an external, it keeps a bare side-effect import to preserve those effects. That import contradicts the dependency's own"sideEffects": false, which is what the consuming bundler reports.The Cloudflare instance is reachable from a single line in
packages/cloudflare/src/sdk.ts:_clearGlobalClientCache is a test-only helper that no entrypoint reaches, so Rollup drops the re-export. clientCache.ts imports GLOBAL_OBJ from @sentry/core, and Rollup hoists that external dependency into sdk.js as a bare import to keep its supposed side effects alive.
#22015 already hit this and special-cased @sentry/conventions. That patched one instance rather than the mechanism, so the next package to trip it, @sentry/core, brought the warnings straight back.
Solution
Now we check for the key
sideEffectsin the respesctitivepackage.json. If there issideEffectsset it will take its value, and if there is non then we assume there are side effects, just as before. With that the warnings are gone.