Warm up Next.js routes after dev server starts

Add a curl request to / after the dev server is ready to pre-compile the main application routes. This triggers Next.js compilation on first access during setup rather than on first user interaction, significantly improving the initial user experience by avoiding 5-10 second compilation delays.

The warm-up is non-blocking - if it fails or times out, the setup continues successfully and routes will compile on first user access as before.
This commit is contained in:
Yann MAHE 2025-11-14 09:53:27 -05:00
parent eb532d98c9
commit 9d7bca80de

View file

@ -179,6 +179,14 @@ while [ $ATTEMPT -lt $MAX_ATTEMPTS ]; do
sleep 1
done
# 8. Warm up the main application routes
log "Warming up main application routes..."
if curl -s -o /dev/null --max-time 30 http://localhost:3001/ 2>/dev/null; then
log "✓ Main routes pre-compiled"
else
log "Warning: Route warm-up timed out or failed (non-critical)"
fi
log ""
log "================================================================"
log "Setup complete! Umami dev server is running on http://localhost:3001"