Skip to content
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 Error with custom directives #218

Closed
EngineerMonkey404 opened this issue Aug 27, 2024 · 5 comments · Fixed by #221
Closed

Nuxt 3 Error with custom directives #218

EngineerMonkey404 opened this issue Aug 27, 2024 · 5 comments · Fixed by #221

Comments

@EngineerMonkey404
Copy link

System info

  • Operating System: Linux
  • Node Version: v20.16.0
  • Nuxt Version: 3.13.0
  • CLI Version: 3.13.0
  • Nitro Version: 2.9.7
  • Package Manager: [email protected]
  • Builder: -
  • User Config: compatibilityDate, devtools, modules, runtimeConfig
  • Runtime Modules: @vueuse/motion/[email protected]
  • Build Modules: -

Reproduction

Create new nuxt project, install @vueuse/motion and add it to nuxt modules, then create custom directive
runtimeConfig: {
public: {
motion: {
directives: {
'pop-bottom': {
initial: { opacity: 0, y: 100 },
enter: {
opacity: 1,
y: 0,
transition: { duration: 400 },
},
}
}

image
then create something like this and you get this
image

Describe the bug

Cannot use custom animation in Nuxt3 with vueuse/motions directive

Additional context

No response

Logs

No response

Copy link

Would you be able to provide a reproduction? 🙏

More info

Why do I need to provide a reproduction?

Reproductions make it possible for us to triage and fix issues quickly with a relatively small team. It helps us discover the source of the problem, and also can reveal assumptions you or we might be making.

What will happen?

If you've provided a reproduction, we'll remove the label and try to reproduce the issue. If we can, we'll mark it as a bug and prioritize it based on its severity and how many people we think it might affect.

If needs reproduction labeled issues don't receive any substantial activity (e.g., new comments featuring a reproduction link), we'll close them. That's not because we don't care! At any point, feel free to comment with a reproduction and we'll reopen it.

How can I create a reproduction?

A link to a stackblitz project or public GitHub repository would be perfect. 👌

Please ensure that the reproduction is as minimal as possible.

You might also find these other articles interesting and/or helpful:

@hajiskyy
Copy link
Contributor

I've added reproduction here: https://stackblitz.com/edit/nuxt-starter-kuu91v?file=app.vue

Also, the issue happened to me after upgrading to the latest version of nuxt

@hajiskyy
Copy link
Contributor

hajiskyy commented Aug 28, 2024

Issue seems to be happening here

const variantsObject = isPreset ? structuredClone(variants || {}) : variants || {}

it seems that we are receiving a vue ref object and so the stucturedClone fails. it's possibly because the directive usage of custom presets from nuxt are Refs?

@hajiskyy
Copy link
Contributor

Not sure who to tag here but i have an open PR that potentially fixes this issue here #221

@Tahul @BobbieGoede

@BobbieGoede
Copy link
Member

This should be resolved thanks to @hajiskyy's contribution! You can install a preview release containing the fix like so npm i https://pkg.pr.new/@vueuse/motion@221 until a new full release has been published.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants