-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nuxt: window is not defined #157
Comments
Same here! to run the project and see the error just install the dependencies and run |
Trying to trace the origin of the error... I believe everything starts here: analytics/packages/web/src/nuxt/index.ts Lines 2 to 5 in 68d0d13
For Nuxt, the createComponent from Vue is being used. In turn, inside the setup function, there's a validation on the window prop, which causes the error to occur:
I'm studying SSR in Nuxt, and I noticed that window only exists after Vue's mounted lifecycle hook... This even makes me question whether analytics works in this kind of architecture, since everything fails during the injection in this validation: analytics/packages/web/src/generic.ts Line 45 in 68d0d13
|
Hey folks! @Viserion77 Analytics should only happen in client side, when a user actually visit your page. So it's expected that we skip everything when (pre)rendering the page on server side. |
@larrasu, @Viserion77 thanks again for the bug report. Version 1.4.1 is out. I'll close this bug, please re-open it if the fix isn't working as expected ! |
I followed the documentation to a T and got the error
window is not defined
when I try to add the<Analytics/>
on theapp.vue
.The text was updated successfully, but these errors were encountered: