3 ms·
Bundling also deletes dead code so it can potentially save a lot, especially if you import huge libraries and only use a small part of them.
by kaoD 7y ago
Bundling also deletes dead code so it can potentially save a lot, especially if you import huge libraries and only use a small part of them.
- kerkeslager 7y agoA much better solution is to not import huge libraries you will only use a small part of.
- z3t4 7y agoCan you give an example of a bundler that removes dead code and not just minifies it? Dead code removal in JS is a bit tricky, unless we are only talking about code after return statements and other low hanging fruit.
- kaoD 7y agoIIRC as long as you use ES modules, tree-shaking is trivial? EDIT: not that trivial https://webpack.js.org/guides/tree-shaking/ https://webpack.js.org/guides/tree-shaking/
- z3t4 7y agoHmm. Now that we have async functions meybe we could also add the pure keyword in order to help optimizations.