chore: add sideeffects field to package.json to enable bundler tree-shaking (#886)#923
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds package metadata indicating the library is side-effect free at module evaluation time, enabling bundlers (e.g., webpack/Turbopack) to more aggressively tree-shake unused modules/exports in consuming applications.
Changes:
- Add
"sideEffects": falsetopackage.jsonto allow consumer bundlers to drop unused@databiosphere/findable-uimodules when appropriate.
…haking (#886) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
d67784b to
d5936b7
Compare
NoopDog
approved these changes
May 20, 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.
Summary
Adds
"sideEffects": falsetopackage.jsonto enable webpack/Turbopack tree-shaking in consumer applications. The library is genuinely side-effect free at module load — this is correct metadata to publish.Closes #886.
Audit
Verified there are no module-load side effects in
src/:.css/.scssimportswindow/global/globalThismutationsconsole.log/addEventListener/ IIFEsletsingletons (dxConfiginconfig/config.ts,kyInstanceinentity/common/client.ts,hasInstalledInterceptorinservices/beforePopState/popStateBus.ts) only declare initial state; mutation happens lazily via exported functions when called by consumerssrc/common/analytics/analytics.tsis purely function-scopedcreateContext(...)(pure)SCHEMAinUseFilterRange,VALIDATION_SCHEMAinSupportRequestForm) are pure construction at module scope — bundler can drop them when unusednew Set<BeforePopStateCallback>()at top ofpopStateBus.tsis pure; interceptor is only installed whenregisterPopStateHandler()is calledVerdict: Option A (
"sideEffects": false) is safe — no allowlist needed.Bundle-analyzer measurement
Tested against data-biosphere (anvil-cmg production build) using
@next/bundle-analyzer:"sideEffects": falseNet delta: ~0 (slight fluctuation is from unrelated v53 changes — MarkdownRenderer DOMPurify removal — bleeding into the AFTER baseline).
Why neutral for data-biosphere
grepof consumer imports:from "@databiosphere/findable-ui/lib/<path>"from "@databiosphere/findable-ui"When a consumer always reaches for specific files via deep imports, the bundler is already loading only what's needed; there's nothing for
sideEffectsto additionally drop. Other findable-ui consumers (anvil-portal, data-browser, etc.) follow the same deep-import convention perCLAUDE.md("External apps import as@databiosphere/findable-ui/lib/<path>"), so the picture is the same across the fleet.Why land it anyway
Test plan
npm run check-format✓npm run lint✓npm run test-compile✓npm test— 49 suites, 425 tests ✓npm run storybookboots cleanly (HTTP 200, 2.72s preview build, no errors)Acceptance criteria
sideEffectsfield added topackage.jsontsc --noEmitpass🤖 Generated with Claude Code