You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 4e8ad9a
Browse filesBrowse the repository at this point in the historyBrowse files
Speed up dev server startup by deferring server app and content config compilation (#17955)
* perf: defer dev server app and content config compilation during dev startup
The dev server app module graph was previously compiled and evaluated on the
critical path inside the astro:server configureServer hook, blocking dev
server creation on ~400ms of on-demand Vite compilation. The content config
load had the same shape during types generation.
Both are now kicked off early during server creation and awaited lazily by
the request handlers / types generator instead. The dev server app compile
is serialized after the content config load so the two don't contend for
the main thread. Compile failures are still logged at startup and surface
on first request.
Measured on a Starlight project (150 pages, warm): dev server ready time
drops from ~910ms to ~550ms, and config-change restarts from ~700ms to
~250ms.
* perf(dev): defer dev server app compile to the first request
* fix(dev): correct types of lazily-created dev server app handler
* fix(dev): finish background setup before shutdown
* fix(dev): start background setup concurrently
* test: allow content watcher time in frontmatter test
* perf(dev): serialize background server setup
Improves dev server startup time. The content config and dev server app module graphs now begin compiling during server creation without blocking the server from listening. Request handling waits for the shared setup result when needed, cutting `astro dev` ready time by roughly a third on projects with a content config.
0 commit comments