Tree Shaking

noun

say it: “TREE SHAY-king” /triː ˈʃeɪkɪŋ/

When a build tool leaves out the code you imported but never use, so the finished files are smaller.

What is Tree Shaking in JavaScript?

Tree Shaking — Removing exports that a build can determine are unused.

In a sentence

  • “Thanks to tree shaking, using one function from a big date library added only a few lines to my build.”
  • “I switched to named imports so tree shaking could drop the parts of the library I never call.”

Level: Freelancer · More JavaScript terms at this level

Updated

In other subjects