A large and complex application can take a long time to download in the browser if not optimized. Build tools utilize processes such as code-splitting, minification, dead-code elimination, and tree-shaking to reduce the size of downloads.
Code-splitting is a technique that allows you to split your code into multiple files or chunks that can be loaded as needed.
Minification is a process that removes comments, whitespace, and other unneeded data from your code. References in the code can also be renamed so that the resulting bundle is smaller.
Dead-code elimination aims to remove any code not actually used by the finished application.
Tree-shaking is a type of dead-code elimination that searches included modules for files and functions that are not used.
Build tools use combinations of these strategies to help streamline your web applications!
Here are some questions to test your understanding of key concepts! Think of your answer first, then click on the “Check Answer” button to check your answer.
What is code splitting?
Code Splitting is a technique that allows you to split your code into multiple files or chunks that can be loaded as needed.