Skip to main content

What does "lazy compilation" mean?

Lazy compilation is an approach where modules are not compiled in advance, but are processed only at the moment they are actually requested by the browser or the application. In other words, instead of building the entire project all at once, compilation is performed "lazily", on demand.


The essence of the mechanism

  • when the dev server starts, compilation is not performed for all files
  • a module is compiled only when a real import or request reaches it
  • unused modules remain "untouched", saving time

What this gives you

ResultWhy
fast dev server startupnothing extra is compiled in advance
instant project opening in the browseronly the startup modules are processed
faster HMRonly the changed fragment is compiled

An important distinction

Lazy compilation is part of the broader "no-bundle"/"on-demand" development trend, where the tool serves code as needed, rather than "just in case".


Summary: Lazy compilation is a lazy compilation mechanism where modules are processed not in advance, but only at the moment they are actually used. This speeds up startup and updates during development.

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.