Skip to content

feat: load dynamic configuration#112

Merged
feugy merged 6 commits intocanaryfrom
damien/o11y-3603-vercelspeed-insights-load-dynamic-configuration
Feb 17, 2026
Merged

feat: load dynamic configuration#112
feugy merged 6 commits intocanaryfrom
damien/o11y-3603-vercelspeed-insights-load-dynamic-configuration

Conversation

@feugy
Copy link
Copy Markdown
Member

@feugy feugy commented Feb 6, 2026

🖖 What's in there?

This PR introduce loads a stringified configuration when injecting the script, which acts as defaults for unspecified properties.
This mechanism is a generic way for Vercel to configure at build time @vercel/speed-insights and other "client side" packages, while allowing users to override the configuration when needed.

Finally, it replaces eslint+prettier with biome, and husky+lint-staged with lefthook, and restore unit tests in CI.

🤺 How to test?

It's not tested on CI, because I need to define configuration strings at build time when deploying the test applications on Vercel. At least the exiting tests are checking that it's fully backward compatible.

As for manual tests:

  1. go to any test application inside the apps/ folder

  2. build the app using the appropriate env var: NEXT_PUBLIC_VERCEL_OBSERVABILITY_CLIENT_CONFIG (Next), PUBLIC_VERCEL_OBSERVABILITY_CLIENT_CONFIG (Astro), VITE_VERCEL_OBSERVABILITY_CLIENT_CONFIG (all others) and give it these values

    1. custom injected script URL '{"speedInsights":{"scriptSrc":"https://acme.com/foo.js"}}'.
    2. production injected script + custom ingestion intake URL '{"speedInsights":{"endpoint":"/foo/bar","scriptSrc":"https://vercel-scripts.com/v1/speed-insights/script.js"}}'
  3. run the application locally (pnpm preview or pnpm start) and browse to it with dev tools open on the network tab.

    1. attempt to inject the script from the provided (fake) url
    2. attempt to collect the page vitals to the provided (fake) url

for example:

cd apps/nextjs
NEXT_PUBLIC_VERCEL_OBSERVABILITY_CLIENT_CONFIG='{"speedInsights":{"scriptSrc":"https://acme.com/foo.js"}}' pnpm build
pnpm start

or

cd apps/sveltekit
VITE_VERCEL_OBSERVABILITY_CLIENT_CONFIG='{"speedInsights":{"scriptSrc":"https://vercel-scripts.com/v1/speed-insights/script.js","endpoint":"http://acme.org/vitals"}}' pnpm build
pnpm preview

🔬Notes to reviewers

All changes on test apps are due to biome's linter and formatter.

@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
speed-insights-astro Ready Ready Preview, Comment Feb 17, 2026 3:52pm
speed-insights-nextjs Ready Ready Preview, Comment Feb 17, 2026 3:52pm
speed-insights-nuxt Ready Ready Preview, Comment Feb 17, 2026 3:52pm
speed-insights-remix Ready Ready Preview, Comment Feb 17, 2026 3:52pm
speed-insights-sveltekit Ready Ready Preview, Comment Feb 17, 2026 3:52pm
speed-insights-vue Ready Ready Preview, Comment Feb 17, 2026 3:52pm

Request Review

@socket-security
Copy link
Copy Markdown

socket-security Bot commented Feb 6, 2026

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.

2 participants