-
Notifications
You must be signed in to change notification settings - Fork 3
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 3] SSR Support #2
Comments
I've also tried it but got no luck. Seems this plugin is not supported for SSR. Hope @bennyxguo will consider to make it support SSR 😁 |
I think this plugin can support SSR via client-only plugin in Nuxt 3. For example, in my case just rename Reference: https://nuxt.com/docs/guide/directory-structure/plugins |
What I did on my Vue/Vite project was installing https://www.npmjs.com/package/vite-plugin-iso-import. Then I defined a plugin that registers the scroll-spy plugin: import {registerScrollSpy} from 'vue3-scroll-spy?client';
export default {
install(app, options: {ssr: boolean}) {
// Fixes: Cannot read properties of undefined (reading 'getSSRProps')
if (options.ssr) {
app.directive('scroll-spy', {})
app.directive('scroll-spy-active', {})
app.directive('scroll-spy-link', {})
}
// Only import when non-SSR
if (typeof registerScrollSpy !== 'undefined') {
registerScrollSpy(app, options);
}
},
} |
I've tried this one but still not working
I'll try this one. Thank you! |
Hello. Thank you for your great work!
Is this package support SSR? I tried install on nuxt 3 but had errors:
Here's code for the plugin:
Thank you
The text was updated successfully, but these errors were encountered: