saberland / saber

()==[:::::::::::::> Build static sites in Vue.js, without the hassle
https://saber.egoist.dev
MIT License
2.15k stars 113 forks source link

'Window is not defined' where to place client-side only scripts? #466

Closed ohiosveryown closed 5 years ago

ohiosveryown commented 5 years ago

I'm trying to use a third-party plugin (flickity) but I'm getting an error when the app tries to build: window is not defined. I initialized the plugin on the mount lifecycle fwiw.

I'm guessing this is because saber/vue is trying to run the plugin while rendering to the page on the server.

Any thoughts?

egoist commented 5 years ago

You probably need to require it in mounted as well.

ohiosveryown commented 5 years ago

hmm, still getting ReferenceError: window is not defined

ohiosveryown commented 5 years ago

Going to try and roll my own instead of using a third-party. FWIW future folks, Embla seems to work fine.