GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Honour package sideEffects when tree-shaking production bundles by kosciak9 · Pull Request #74 · elixir-volt/volt

Conversation

@kosciak9

@kosciak9 kosciak9 commented Oct 15, 2026

Copy link
Copy Markdown

Production bundles are built from a virtual project (OXC.bundle/2 writes the compiled modules into a temp directory) in which a package's files sit under the package name, but the package's own package.json is not written. Rolldown reads sideEffects from the nearest package.json, so it could not see it and kept every unused module that runs code at the top level.

The effect is large for icon libraries: each icon in iconoir-react and lucide-react is a module like export default forwardRef(Icon), so importing ~100 icons kept all ~3,500 of them. In our app that was ~2.7 MB of a 6.9 MB minified bundle.

This writes a minimal package.json holding only sideEffects at the root of each bundled package that declares it, for every bundling path (single entry, shared entries, code-split chunks). Packages that don't declare sideEffects are unchanged.

Test: drops unused modules of packages declaring no side effects in resolution_test.exs builds two packages whose modules call an imported function at the top level; the unused module of the sideEffects: false package is dropped, while the sideEffects: true package keeps it. It fails without the change.

Locally mix test passes except CaseBrowserTest (no Playwright here) and one BundleTest case that fails with {:not_found, "lit-html"} only in the full run and passes on its own.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@kosciak9
Honour package sideEffects when tree-shaking production bundles
74e2e6c
Production bundles are built from a virtual project without the packages' package.json files, so Rolldown could not see sideEffects and kept every module that runs code at the top level, such as icons wrapped in forwardRef. Write a minimal package.json carrying sideEffects at each bundled package's root.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@kosciak9
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.