Skip to content
T

tree-shaking

Teaches tree shaking for dead code elimination in JavaScript bundles

by patternsdevFree

#9954in AI Skills
0In stores

Description

Explains tree shaking, the build step that removes unused code from a JavaScript bundle before it ships. Code that is imported but never use…

Highlights

  • Use ES module import and export syntax
  • Import named exports rather than whole modules
  • Mark side-effect-free packages in package.json
  • Why modules with side effects are kept

Ratings & Reviews

No ratings yet

Be the first to rate tree-shaking.

People also visit

A

audit-and-reduce-dependencies

Reduces JavaScript dependency footprint

AI Skills
Get
K

knip

Run knip to find and remove unused files, dependencies, and exports

AI Skills
Get
J

javascript-pro

Writes, debugs, and refactors JavaScript code

AI Skills
Get
S

specs-code-cleanup

Provides final code cleanup after task review approval

AI Skills
Get
R

react-doctor

Diagnose and fix React codebase health issues

AI Skills
Get
C

conserve

Context optimization, bloat detection, CPU/GPU monitoring

AI Skills
Get

tree-shaking FAQ

What is tree shaking?

Removing code that is imported but never used, so the JavaScript bundle that ships is smaller.

Why does import style matter?

Only ES modules can be tree-shaken, and named imports let the bundler see which exports are unused.

Does it remove every unused module?

No. Modules with side effects cannot be safely removed, even when their exports look unused.

How do I install it?

Run: npx skills add https://github.com/patternsdev/skills --skill tree-shaking

What do the security audits show?

Gen Agent Trust Hub: Pass. Socket: Pass. Snyk: Pass.

What are the best tree-shaking alternatives?

Popular alternatives to tree-shaking include audit-and-reduce-dependencies, knip and javascript-pro. See all tree-shaking alternatives

Developer Stuff

Badges