Skip to content

Commit 56ebed2

Browse files
authored
fix(#157): error when rendering Nuxt component (#160)
1 parent 68d0d13 commit 56ebed2

File tree

3 files changed

+2
-6
lines changed

3 files changed

+2
-6
lines changed

Diff for: packages/web/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vercel/analytics",
3-
"version": "1.5.0-canary.1",
3+
"version": "1.4.1",
44
"description": "Gain real-time traffic insights with Vercel Web Analytics",
55
"keywords": [
66
"analytics",

Diff for: packages/web/src/generic.ts

-4
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ export const DEV_SCRIPT_URL =
2020
'https://va.vercel-scripts.com/v1/script.debug.js';
2121
export const PROD_SCRIPT_URL = '/_vercel/insights/script.js';
2222

23-
export const basepathVariableName = 'NEXT_PUBLIC_WEB_ANALYTICS_BASEPATH';
24-
2523
/**
2624
* 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).
2725
* @param [props] - Analytics options.
@@ -69,8 +67,6 @@ function inject(
6967
}
7068
if (props.endpoint) {
7169
script.dataset.endpoint = props.endpoint;
72-
} else if (process.env[basepathVariableName]) {
73-
script.dataset.endpoint = `/${process.env[basepathVariableName]}/_vercel/insights`;
7470
}
7571
if (props.dsn) {
7672
script.dataset.dsn = props.dsn;

Diff for: packages/web/src/vue/create-component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export function createComponent(
1919
framework,
2020
});
2121
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- route is undefined for barebone vue project.
22-
if (route && window) {
22+
if (route && typeof window !== 'undefined') {
2323
const changeRoute = (): void => {
2424
pageview({
2525
route: computeRoute(route.path, route.params),

0 commit comments

Comments
 (0)