Using Rollup Tree‑Shaking to Remove Unused JavaScript Code
Learn how to configure Rollup’s built‑in tree‑shaking to drop dead exports, understand its limits, and verify that the bundle really shrinks.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
Learn how to configure Rollup’s built‑in tree‑shaking to drop dead exports, understand its limits, and verify that the bundle really shrinks.
CoffeeScript default CommonJS module output incompatible with ES‑module bundlers The CoffeeScript compiler (v1.x) emits CommonJS require and module.exports statements by default. Production builds that bundle the generated JavaScript with tools configured for ES modules (e.g., Webpack, Rollup) often encounter runtime errors such as Uncaught ReferenceError: m
Lodash / Lodash‑ES Integration In a monorepo or multi‑project setup, developers often import from both lodash (CommonJS) and lodash-es (ESM). The goal is to maintain a repeatable build that is both size‑efficient and type‑safe across webpack, Rollup, and other bundlers. Goal: Repeatable Development Environment We need a strategy that guarantees deterministic
Goal Ensure that a RubyMine project runs with the same dependencies locally and in production, preventing “works on my machine” failures during deployment. Constraints RubyMine automatically selects the interpreter defined in project settings, but it does not apply the gemset specified by .ruby-version or .ruby-gemset unless the developer explicitly adds the
Goal Diagnose a failed deployment that stops at build time when Bun’s bundler encounters a CommonJS module or a circular ES module dependency. Constraints Bun’s bundler accepts only ES modules; attempting to import a CommonJS module (e.g., require('fs') ) during bun build triggers a compile‑time error. Dynamic imports must use a literal string; import(module
We run a small Rails app in RubyMine using a remote Ruby SDK backed by Docker Compose, so run, debug, and test configurations execute inside the container while editing stays local. This works, but every gem change currently means rebuilding the image before the SDK's gem list re-syncs and code insight catches up. We are considering moving the bundle path ou
Constraint When a p5.js sketch loads images or sound files with loadImage() or loadSound() it works without extra configuration while the page is opened via a file:// URL. Production requirement In a production deployment served over HTTP/HTTPS the same relative paths trigger CORS errors unless the server sends the appropriate Access‑Control‑Allow‑Origin hea