Jump to content
GreenSock

danboyle8637

Bonus Plugins not loading

Recommended Posts

I just renewed today so I'm not sure this has something to do with it... but my bonus plugins are not loading.

 

I'm using NextJS (newest version), React. 

I am using Typescript as well and I noticed the DrawSVGPlugin was a JS file.

 

import { gsap } from 'gsap'
import { DrawSVGPlugin } from 'gsap/DrawSVGPlugin'

const MyComponent = () => {

  // I tried this outside the component as well as...
  // And in a useEffect that runs when the component mounts.
  gsap.registerPlugin(DrawSVGPlugin)
  
  useEffect(() => {
  	tl.to(element, {
    	drawSVG: '0% 100%'
    })
  }, [])

}

I am getting the following error It's attached. 

1247975518_ScreenShot2020-02-19at1_40_08PM.thumb.png.296c068b34c6a1757610f1128e8ac125.png

Link to comment
Share on other sites

Hm, that message typically means you're using ES Modules in an older environment that doesn't support them. Maybe try importing the UMD versions of the GSAP files which are pretty universally compatible - those are tucked in the /dist/ directory:

 

import { gsap } from 'gsap/dist/gsap'
import { DrawSVGPlugin } from 'gsap/dist/DrawSVGPlugin'

Does that work better for you? 

 

If not, it'd be super helpful if you could post a reduced test case that reproduces the issue. We'd love to help. 

  • Like 2
Link to comment
Share on other sites

@GreenSock Yes that seemed to work. 

 

Strange since the base gsap works fine. I'll keep messing around but thank you for your help!

  • Like 1
Link to comment
Share on other sites

19 minutes ago, danboyle8637 said:

Strange since the base gsap works fine.

 

Even though you didn't tell it to, your setup was actually loading from gsap/dist/gsap

 

Whenever you see something related to cjs (CommonJS), that means you should use the dist files.

 

image.png.f1b347c1e0f709484fb71a479a2b365f.png

 

  • Like 4
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×