What is Module Lazy Loading?

28 March 2022

Lazy loading is a pattern where code is only loaded or initialized the first time it is needed. Bundlers like webpack allow for module lazy loading, which uses this pattern to reduce the size of bundles by not including rarely used dependencies in the final bundle. Instead, references to those dependencies are wrapped in JavaScript promises that are triggered only when used by the client.

Further reading