Tree shaking
Leaving unneeded parts of a set of modules out of the output.
What is tree shaking?
Tree shaking removes unneeded code parts from the output. In JavaScript, the statically analysable structure of ES modules with imports and exports helps this process. What can be removed depends on the tool, module structure, configuration and side effects. The term does not promise that every unused piece of code can be safely identified.
In a fictional portal, only date formatting is needed from a utility library. The team checks which other parts disappear from the generated package. A blanket declaration of no side effects would be risky if loading a module registers required functions or includes styles. Those effects must remain. Size and behaviour are compared in the actual result; enabling an optimisation option proves neither savings nor correct function.
Sources
Related terms
- BundlerA tool that groups connected modules and resources into files for delivery.
- Build processThe defined workflow that produces software artifacts from inputs such as source code and dependencies.
- Code splittingDividing program code into separately loadable parts and planning when they load.
- Legacy systemAn existing system still in use, with technical and business dependencies accumulated over time.
- Multi-tenancyMulti-tenancy supports separate customer or group scopes in one solution. A tenant is not automatically one person or one database.
- Browser cacheThe browser cache stores suitable HTTP responses for later use. Reuse and revalidation follow the applicable rules.
Articles on this topic








Software Development with ASES
Custom software, web and mobile apps


