gitwtfhub

wtf is rollup-side-effect-bug?

mbostock/rollup-side-effect-bug — explained in plain English

Analysis updated 2026-08-03 · repo last pushed 2024-06-03

JavaScriptAudience · developerComplexity · 1/5DormantSetup · easy

TL;DR

A minimal test case that reproduces a bug in the Rollup JavaScript build tool, showing how its handling of the sideEffects flag incorrectly deletes code during tree shaking and breaks working applications.

Mindmap

mindmap
  root((repo))
    What it does
      Reproduces Rollup bug
      Tests sideEffects flag
      Proves tree shaking issue
    Tech stack
      JavaScript
      Rollup
      Node.js
    Use cases
      Debug broken builds
      Report Rollup issues
      Verify fix viability
    Audience
      JavaScript developers
      Library maintainers
      Project managers

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Reproduce a Rollup tree-shaking bug where the sideEffects flag causes code to be incorrectly removed.

REASON 2

Confirm that removing the sideEffects declaration from a package config resolves the issue.

REASON 3

Provide maintainers a clear diagnostic example to investigate and fix the underlying bug.

What's in the stack?

JavaScriptRollupNode.js

How it stacks up

mbostock/rollup-side-effect-bug00kaku/gallery-slider-block0verflowme/weirdhta
LanguageJavaScriptJavaScriptJavaScript
Last pushed2024-06-032021-05-192022-06-16
MaintenanceDormantDormantDormant
Setup difficultyeasyeasymoderate
Complexity1/52/52/5
Audiencedevelopergeneraldeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · easy Time to first run · 5min

Requires Node.js and Rollup installed to run the reproduction commands.

No license information is provided in this repository.

Wtf does this do

This repository is a small test case that reproduces a specific bug in a popular JavaScript build tool called Rollup. The project exists to prove that something is going wrong when Rollup processes a package setting called sideEffects, which is a flag developers use to tell build tools which files in their project have meaningful side effects (like modifying global state) and which are safe to delete if unused. The repo is tied to a bug report filed by Mike Bostock, the creator of the D3 visualization library, on the Rollup GitHub page. To understand the problem, it helps to know that when you write JavaScript, you often import a lot of code you don't end up using. Modern build tools try to make your final file smaller by removing the unused parts, a process called "tree shaking." The sideEffects field in a project's configuration helps the build tool decide what it can safely remove without breaking the application. This test case demonstrates that Rollup is incorrectly deleting or altering code based on this flag, which can break a functioning application. A developer or project manager working on a JavaScript library, especially something visual like D3, would run into this issue when their build process unexpectedly breaks their code. By running a couple of simple commands, someone experiencing the bug can see the problem happen in real time. The project also includes a simple way to confirm the cause: if you remove the sideEffects declaration from the test package's configuration and run the test again, the problem goes away, proving that the flag is the culprit. The project itself is purely a diagnostic tool. It contains no features or application logic. Its sole purpose is to serve as a clear, reproducible example so the maintainers of Rollup can investigate and fix the underlying tree-shaking issue.

Yoink these prompts

Prompt 1
I have a JavaScript library and Rollup is removing code it shouldn't when sideEffects is set in my package.json. Walk me through how to create a minimal reproduction case to confirm the bug.
Prompt 2
Help me understand how the sideEffects field in package.json affects Rollup's tree shaking, and what could go wrong if Rollup misinterprets it.
Prompt 3
I think Rollup's tree shaking is deleting code I need when I use the sideEffects flag. What are some workarounds until the bug is fixed?

Frequently asked questions

wtf is rollup-side-effect-bug?

A minimal test case that reproduces a bug in the Rollup JavaScript build tool, showing how its handling of the sideEffects flag incorrectly deletes code during tree shaking and breaks working applications.

What language is rollup-side-effect-bug written in?

Mainly JavaScript. The stack also includes JavaScript, Rollup, Node.js.

Is rollup-side-effect-bug actively maintained?

Dormant — no commits in 2+ years (last push 2024-06-03).

What license does rollup-side-effect-bug use?

No license information is provided in this repository.

How hard is rollup-side-effect-bug to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is rollup-side-effect-bug for?

Mainly developer.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.