rmonell Posted November 5, 2020 Share Posted November 5, 2020 Hello Today I encountered an issue while trying to use gsap/Draggable in a Nuxt project I've imported the plugin like so : import { gsap } from 'gsap' import { Draggable } from 'gsap/Draggable' gsap.registerPlugin(Draggable) But here is the error I get : Could someone explain me if there are a particulary maniupulation to use gsap plugins in Nuxt ? Thank you in advance for your time ! Link to comment Share on other sites More sharing options...
Solution ZachSaucier Posted November 5, 2020 Solution Share Posted November 5, 2020 Hey rmonell. As covered in the installation docs, you should transpile GSAP. Put the following in your nuxt.config: build: { ... transpile: ['gsap'], }, Then you should be able to import GSAP and Draggable as such: import { gsap } from "gsap"; import { Draggable } from "gsap/Draggable"; if (process.client) { gsap.registerPlugin(Draggable); } 3 1 Link to comment Share on other sites More sharing options...
rmonell Posted November 5, 2020 Author Share Posted November 5, 2020 Hello @ZachSaucier Thanks a lot it works perfectly ! I think my next step as developer will be to learn how to correctly read a doc 😄 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now