Jump to content
Search Community

yarn add gsap and TweenLite issues

overdub60 test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

I've installed gsap with

yarn add gsap

 

I then import TweenLite like this

import { TweenLite, Power2 } from 'gsap';

 

When I look into my build, I see that the full TweenMax bundle is included in the build. Is there a way around that? I would prefer to just have TweenLite in there.

 

I realize that the preferred method is using the CDN but I would still like to use the npm/yarn version.

Link to comment
Share on other sites

Yeah, sorry about the confusion there - "gsap" actually just points to TweenMax right now (which includes TweenLite, Power2 and a whole bunch of other stuff). We're working on an ES6 module version, but it's not ready yet. Anyway, for now you can just import things directly like:

 

import TweenLite from "gsap/TweenLite";

 

As for the ease, it's added to the global scope by TweenLite anyway, so you should be able to reference that but you can also just use a string version anyway like ease:"Power2.easeOut". 

 

Does that help? 

Link to comment
Share on other sites

Thanks @GreenSock, unfortunately this doesn't work either. I'm using TypeScript and I get an error that complains about missing types, even though I already installed types/gsap...

 

TS7016: Could not find a declaration file for module 'gsap/TweenLite'. 'node_modules/gsap/TweenLite.js' implicitly has an 'any' type.
Try 'npm install @types/gsap' if it exists or add a new declaration (.d.ts) file containing `'declare module 'gsap';`

 

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...