Skip to solution
hardFrontend

What is the difference between AOT and JIT compilation?

1.2k views
01

Understand the problem

Compare Ahead-of-Time and Just-in-Time.

compilationaot
02

Attempt it yourself

Sketch your approach before reading the solution — that's what interviews test.

Nudge consolestandby

Stuck? Beam a request up — the console returns a conceptual nudge that guides your logic without spoiling the implementation.

03

Study the solution

JIT compiles templates in the browser at runtime — handy for development. AOT compiles templates during the build, so the browser ships pre-compiled code: faster startup, smaller bundle (no compiler shipped), and template errors caught at build time. AOT is the production default.

Solution ready — 2 min read

Classified // press E to declassify

04

Read the code

AOT is the default build
# Production build → AOT-compiled, optimized, tree-shaken
ng build --configuration production

# Templates compile at BUILD time, so an error like a typo'd binding
#   <p>{{ titel }}</p>     <!-- property 'titel' does not exist -->
# fails the build (AOT) instead of silently breaking at runtime (JIT).

# Since Angular 9 (Ivy), 'ng serve' also uses AOT by default.
05

Join the discussion

Discussion (0)

Sign in to join the discussion.

No responses yet. Be the first to share what you think.

Transmission complete // awaiting log

KEEP THE
STREAK ALIVE.

Dossier 79 of 121 decoded in the Angular track. One more won't hurt.

Back to track