-
Notifications
You must be signed in to change notification settings - Fork 17
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 directive error #40
Comments
Same issue here |
Have a look at nuxt/nuxt#13351 and nuxt/nuxt#14568. Probably this can be solved by removing I got around this by implementing my own |
Sorry for the delay all! I've just pushed [email protected], which is intended for Vue/Nuxt 3 (1.x.x only supports Vue/Nuxt 2). The issue here was harder to debug than I'd imagined, and in the end came down to the filename -- rather than Please let me know if this does/does not work for you! If it all goes well, I'll officially publish to NPM on Saturday (31 September)! |
It is interesting that this depends on the filename. In the nuxt 3 docs they even make an example with a kebab case plugin name: Does there speak anything against registering this plugin with I suggest adding a default export with a custom vue plugin: export default {
install: (app, options) => {
app.directive('scroll-reveal', vScrollReveal);
},
}; Probably this will need a generator function Also note that I had problems when using this plugin in combination with nuxt page transitions: .page-leave-active,
.page-enter-active {
transform: translateY(0);
transition: all 0.3s;
}
.page-enter-from,
.page-leave-to {
opacity: 0;
transform: translateY(-15px);
} This is probably not an issue of this plugin but I could only get this work by adding a timeout of the duration of the page transition. Without this timeout ScrollReveal was always bugged (some elements were hidden with |
@tserkov Hello! Thanks for working on this! Not sure if I am doing something wrong here, but....
Deleted Any ideas? |
https://www.npmjs.com/package/vue-scroll-reveal?activeTab=versions Version 2 is not yet released on npm. |
@WolfgangDrescher Good point! He literally said he'd publish to NPM this week haha, silly me. Any suggestions how to test this out without using NPM? |
Probably like this: clone repository, checkout |
That is interesting! My best guess is that a path or name normalizer (isn't the culprit always regex?) is being inconsistently applied for auto-discovered plugins for the each client/server/global mode.
Glad to hear that feature is in demand! I've implemented it as createScrollRevealDirective, which returns a directive -- no need to much around with plugins. 😄 README and version updated to match (v2.1.0)-- let me know how it works for you!
If you get some time, I know you mentioned you ran a custom local ScrollReveal directive; if it happens with that version too, then it's likely a Nuxt+ScrollReveal limitation. If so, I imagine your comment in this issue should help anyone who bumps into the buginess future. |
Could be, but I haven't looked into it too much. I don't know if this is already a known issue in nuxt 3. Maybe it's worth opening an issue in their repository for this?
Nice solution, thank you. You can even clean this up a bit like this: export const vScrollReveal = createScrollRevealDirective({});
I just tested your new changes. Still the same buggy behaviour without a timeout of the duration of the page transition. So anyone who runs into this problem has to create a custom directive anyway. Or do you think it is worth implementing this into this plugin. I don't think so. I really just did this: // wait for page transition to end
setTimeout(() => {
reveal(el, value, modifiers);
}, 320); We could add this by adding an additional parameter to the |
I've given this a go, but unfortunately can't get it working with either of @WolfgangDrescher's approaches. Using
The file is named
Additionally, deleted Not sure if I'm doing something wrong here? |
I'm also not entirely sure about this problem. I did also get this error several times with other plugins. You can try to remove https://github.com/rigor789/vue-scrollto/pull/715/files |
It seems like v2 is not yet released on npm: https://www.npmjs.com/package/vue-scroll-reveal?activeTab=versions |
Thanks, I've just published it! 🙈 |
Hello,
I tried to install this plugin in my Nuxt 3 (rc3) app. I registered the plugin as scroll-reveal.client.ts and added v-scroll-reveal to my html element, but get a Vue warning:
"Failed to resolve directive: scroll-reveal [nitro] [dev] [unhandledRejecton] TypeError: Cannot read properties of undefined (reading 'getSSRProps')"
Is this plugin not yet "adapted" to the new nitro engine or am I doing something wrong?
Thanks for your help,
Simon
Plugin:
Component:
<h1 v-scroll-reveal>Meet the Team.</h1>
The text was updated successfully, but these errors were encountered: