Jump to content
Search Community

importing the premium plugins in react

Luckyde 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

Hi there,
I'm having problems importing the customEase, Bounce and Physics modules to react, i saw 


but that didnt really fix my problem,

I tried to seperately load the customEase for example, but i still had the same error it had a gsap dependancy

I tried to put the UMD version of customEase into nodeModules>gsap>UMD >customEase
then the longway approach of 


but then i get 

undefined is not a constructor (evaluating 'new (_$$_REQUIRE(_dependencyMap[11], "gsap").TimelineMax)()')


Our codebase is in typescript so I had to use https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/gsap
To get the main library to work do i need to modify this and create my own extension for the plugins for them to work on React?

Anyone had experience with this? :)

Thank you

Link to comment
Share on other sites

Hi @Luckyde

With our projects, we have a plugins directory that we import from as such:


import CustomEase from './../static/plugins/CustomEase';



As far as using Require, I've found that I had to do so when using GSAP's premium products (SplitText, etc), which I access in a similar manner:



with the Require, I need to add SplitText as an exception in the globals of the .eslintrc file.


Hope this helps!

  • Like 1
Link to comment
Share on other sites

Thanks @elegantseagulls! With yours did you use the version of the plugins in the minified verison, the npm or the umd verison? just to make sure mine match, i'm still getting the same Dependency errors if i use the normal minified version

 _$$_REQUIRE(...).TimelineMax is not a constructor
Link to comment
Share on other sites



We're using the files from 'bonus-files-for-npm-users > umd`


Also, TimelineMax isn't referenced in this CustomEase.js, so I have a feeling your error may be coming from somewhere else.


Also, to elaborate on my first reply a bit:

The important reason for not putting the file in the node_modules dir is that these files won't be referenced in the package.json file, so if someone were trying to work with your environment from a new machine (assuming your node_modules is in .gitignore as it should be), those files wouldn't be available to yarn/npm install etc. 



  • Like 1
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...