Static GitHub Issues

[3104] Using window on server side

prev: Preserving scroll position using alias to same route
next: "Mismatching childNodes vs. VNode": "nuxt-link" inside a "v-for"

Hey, I would like to make a file called variables.js that expose some helpers.

In those helpers I would like to use one called :

export const isMobile = typeof window !== "undefined" ? window.matchMedia("(min-width: 1000px)") : false;

I would like to know if there is a proper way to deal with that ? Am I wrong ?

BEst regards

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c2689">#c2689</a>)</em></sub></div>