Jump to content
Search Community

Create React App & scrollToPlugin

BradLee test
Moderator Tag

Go to solution Solved by GreenSock,

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

Hey guys,

 

I'm having trouble trying to import scrollToPlugin via webpack. This is the error I'm getting - 

 

 Error in ./~/gsap/src/uncompressed/plugins/ScrollToPlugin.js Module not found: 'TweenLite'

 

 

I've read in other posts that you modify the webpack.config file to resolve this however I'm using create-react-app and don't have access to the config file. Does anyone know a way around this?

Link to comment
Share on other sites

  • Solution

Hm, that's odd that you don't have access to the config file, but I can think of two other options:

  1. Just use a <script> tag for the GSAP-related stuff. You could load the files from the CDN and get the benefits of caching too. 
  2. -OR- delete the 4th line from the bottom of ScrollToPlugin where it says require("../TweenLite.js");

Do either of those work for you? 

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