eddiemf / vue-scrollactive

Lightweight and simple to use vue component that highlights menu items as you scroll the page, also scrolling to target section when clicked.
MIT License
542 stars 70 forks source link

SSR Support #16

Closed davidbwaters closed 5 years ago

davidbwaters commented 6 years ago

Hi. This was exactly what I was looking for, but I'm working on a project that uses SSR. I'm new to Vue, but I assume since this uses window that SSR won't work out of the box. I know there is a way that fakes window to make most Vue plugins to work on the server side, but I'd like to avoid this, if possible. I noticed vue-scrollto plugin got it working with this simple fix. They just changed if (window.Vue)... to if (typeof window !== "undefined" && window.Vue)...

Could something like that be easily applied to this project?

eddiemf commented 6 years ago

Hello @davidbwaters, sorry for the very delayed response, I just relocated to another country and was completely off from Github for some time.

I'm sorry to hear that it's not working for you, I have no experience at all with Nuxt (I assume you're using it for SSR), so obviously the plugin was also not tested in any SSR environment, so I'm afraid I can't really help you with that :(

Regarding your fix, if you check https://github.com/eddiemf/vue-scrollactive/blob/f80c0ab1cb87f481f97608166d2872bee82ccad8/src/index.js#L11 that I already do that to install the plugin, so it's not the same window problem as you mentioned :/

Do you have any error log or feedback that could help me identify the problem?

Thanks for the feedback!

Goopil commented 6 years ago

This is a webpack issue.

Looking in to it as I also use your great package with nuxt