Skip to content

Conversation

@TheodoreRed
Copy link

📓 What's in there?

This PR improves the script injection process for Vercel Speed Insights by adding a warm-up function. Before injecting the main script, the code performs a fetch to the script URL to "warm up" the endpoint (even if the first response might be HTML). This change is intended to reduce errors related to cold starts, ensuring that when the actual script is loaded, the endpoint is ready to serve valid JavaScript.

Issue #98

🧪 How to test?

Open a page that uses Speed Insights injection.

Verify that the script tag is appended to the document head after the warm-up call.

❗ Notes to reviewers

This change is purely additive and does not affect the core functionality of Speed Insights.

Please verify that this approach reduces errors associated with cold starts without introducing side effects in both development and production environments.

@vercel
Copy link

vercel bot commented Mar 26, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
speed-insights-astro ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 26, 2025 11:20pm
speed-insights-nextjs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 26, 2025 11:20pm
speed-insights-nuxt ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 26, 2025 11:20pm
speed-insights-remix ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 26, 2025 11:20pm
speed-insights-sveltekit ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 26, 2025 11:20pm
speed-insights-vue ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 26, 2025 11:20pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant