Example of js + webpack 4 + tree-shaking Prerequisites Install git Install nodejs Build The Project Clone this repository run cd /path/to/this/folder run npm install run npm run build Notes Tree-shaking only applies to production mode / npm run build You should not see the function of sapi & kuda in bundle.js Webpack guides of tree-shaking