tree-shaking

Remove unused exports from JavaScript ES module bundles during build time.

Updated Oct 26, 2025
One-click install
npx skills add https://github.com/jcsoftdev/pulzifi-back --skill tree-shaking-jcsoftdev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tree-shaking
Source: https://github.com/jcsoftdev/pulzifi-back/tree/main/.claude/skills/tree-shaking
Command: npx skills add https://github.com/jcsoftdev/pulzifi-back --skill tree-shaking-jcsoftdev

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Tree shaking eliminates unused exports from JavaScript bundles, reducing bundle size and improving load performance by ensuring only used code is included in the final build.

Core Features & Use Cases

  • Identify and remove dead code from ES module graphs to minimize bundle size.
  • Encourage side-effect-free module design and safer packaging across bundlers.
  • Use with modern bundlers (Webpack, Rollup, ESBuild) to optimize production builds and improve startup times.

Quick Start

Run the tree-shaking pass on your JavaScript project to remove unused exports and shrink the final bundle.

Frequently Asked Questions about tree-shaking

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How does tree shaking remove unused exports from JavaScript bundles?

Tree shaking removes unused exports by statically analyzing the ES module graph during build time, ensuring only used code is included in the final bundle without changing runtime behavior.

What is dead code elimination and when do I need it for my JavaScript project?

Dead code elimination strips unused code from large codebases or libraries during production builds, reducing final bundle size and improving application load performance.

How do I configure tree shaking with modern bundlers like Webpack and Rollup?

You configure tree shaking by running build passes on ES module projects with modern bundlers like Webpack, Rollup, or ESBuild, which rely on static analysis to safely remove unused exports.

Does tree shaking work with CommonJS modules or only with ESM?

Tree shaking works on ES module projects because it relies on the static structure of ESM imports and exports to safely identify and remove dead code during the build process.

How do package.json side effects impact dead code elimination in bundlers?

Tree shaking respects side effects declared in package.json to ensure safe removal, preventing the bundler from dropping modules that might perform necessary runtime operations when imported.

Why is my JavaScript bundle size still large after applying tree shaking?

Tree shaking effectiveness depends on side-effect-free module design; if your large codebase or libraries declare side effects in package.json, the bundler cannot safely remove those unused exports.