Skip to content

Commit

Permalink
fix(#157): error when rendering Nuxt component
Browse files Browse the repository at this point in the history
  • Loading branch information
feugy committed Nov 19, 2024
1 parent 68d0d13 commit dca7434
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 6 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/analytics",
"version": "1.5.0-canary.1",
"version": "1.4.1",
"description": "Gain real-time traffic insights with Vercel Web Analytics",
"keywords": [
"analytics",
Expand Down
4 changes: 0 additions & 4 deletions packages/web/src/generic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ export const DEV_SCRIPT_URL =
'https://va.vercel-scripts.com/v1/script.debug.js';
export const PROD_SCRIPT_URL = '/_vercel/insights/script.js';

export const basepathVariableName = 'NEXT_PUBLIC_WEB_ANALYTICS_BASEPATH';

/**
* Injects the Vercel Web Analytics script into the page head and starts tracking page views. Read more in our [documentation](https://vercel.com/docs/concepts/analytics/package).
* @param [props] - Analytics options.
Expand Down Expand Up @@ -69,8 +67,6 @@ function inject(
}
if (props.endpoint) {
script.dataset.endpoint = props.endpoint;
} else if (process.env[basepathVariableName]) {
script.dataset.endpoint = `/${process.env[basepathVariableName]}/_vercel/insights`;
}
if (props.dsn) {
script.dataset.dsn = props.dsn;
Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/vue/create-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function createComponent(
framework,
});
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- route is undefined for barebone vue project.
if (route && window) {
if (route && typeof window !== 'undefined') {
const changeRoute = (): void => {
pageview({
route: computeRoute(route.path, route.params),
Expand Down

0 comments on commit dca7434

Please sign in to comment.