Dead code elimination in dynamic languages is a much harder problem than in static languages. The idea of a "treeshaker" originated in LISP in the 1990s. The idea is that all possible execution flows of a program can be represented as a tree of function calls, so that functions that are never called can be eliminated.
The next wave of popularity of the term is attributed to Rich Harris’s Rollup project developed in 2015.
Relation to ECMAScript 6 modules