Jump to content
Search Community

GSAP MorphSVGPlugin not found NextJS

Ishan Shishodiya test
Moderator Tag

Recommended Posts

import gsap from "gsap";
import MorphSVGPlugin from "gsap/dist/MorphSVGPlugin";
gsap.registerPlugin(MorphSVGPlugin);

I have the above code written in a NextJS project, but am getting the error -

Module not found: Can't resolve 'gsap/dist/MorphSVGPlugin'

I saw in one forum post that this error was occurring because MorphSVGPlugin is a Club GreenSock plugin, so instead tried importing it from `gsap-trial` instead of `gsap` but still had the same error. What can be done here?

Link to comment
Share on other sites

Have you tried changing the import statement when moving to gsap-trial? These packages are limited to where you can use them, but if you're only working locally you should be fine to test all the Club GreenSock packages out for free! Check out more info over at https://www.npmjs.com/package/gsap-trial. Hope it helps and happy tweening! 

 

import gsap from "gsap-trial";
import MorphSVGPlugin from "gsap-trial/MorphSVGPlugin";

// Or UMD imports
import gsap from "gsap-trial/dist/gsap";
import MorphSVGPlugin from "gsap-trial/dist/MorphSVGPlugin";
  • Like 1
Link to comment
Share on other sites

Hi,

 

On top of @mvaneijgen great advice, please take a look at this NextJS starter template using the GSAP Trial package:

https://stackblitz.com/edit/nextjs-efumgr?file=pages%2F_app.js

 

Also if you normally work in React/NextJS we have these collections so you can create minimal demos when/if you run into any issues:

https://stackblitz.com/@GreenSockLearning/collections/gsap-react-starters

https://stackblitz.com/@GreenSockLearning/collections/gsap-nextjs-starters

 

Hopefully this helps.

Happy Tweening!

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.
×
×
  • Create New...