Skip to content

Commit

Permalink
chore: use variable
Browse files Browse the repository at this point in the history
  • Loading branch information
feugy committed Nov 14, 2024
1 parent 47fff4e commit a24b00c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vercel/speed-insights",
"version": "1.1.0",
"version": "1.2.0-canary.1",
"description": "Speed Insights is a tool for measuring web performance and providing suggestions for improvement.",
"keywords": [
"speed-insights",
Expand Down
5 changes: 3 additions & 2 deletions packages/web/src/generic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const SCRIPT_URL = 'https://va.vercel-scripts.com/v1/speed-insights';
const PROD_SCRIPT_URL = `${SCRIPT_URL}/script.js`;
const DEV_SCRIPT_URL = `${SCRIPT_URL}/script.debug.js`;
const PROXY_SCRIPT_URL = '/_vercel/speed-insights/script.js';
const basepathVariableName = 'NEXT_PUBLIC_SPEED_INSIGHTS_BASEPATH';

/**
* Injects the Vercel Speed Insights script into the page head and starts tracking page views. Read more in our [documentation](https://vercel.com/docs/speed-insights).
Expand Down Expand Up @@ -57,8 +58,8 @@ function injectSpeedInsights(
}
if (props.endpoint) {
script.dataset.endpoint = props.endpoint;
} else if (process.env.NEXT_PUBLIC_SPEED_INSIGHTS_ENDPOINT_PATH_PREFIX) {
script.dataset.endpoint = `/${process.env.NEXT_PUBLIC_SPEED_INSIGHTS_ENDPOINT_PATH_PREFIX}/_vercel/speed-insights/vitals`;
} else if (process.env[basepathVariableName]) {
script.dataset.endpoint = `/${process.env[basepathVariableName]}/_vercel/speed-insights/vitals`;
}
if (props.dsn) {
script.dataset.dsn = props.dsn;
Expand Down

0 comments on commit a24b00c

Please sign in to comment.