Brad Woods Brad Woods - 1 year ago 157
React JSX Question

Error using GSAP's scrollToPlugin with create-react-app

I'm trying to use GSAP's scrollToPlugin with facebook's 'create-react-app' however I get this error -

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

I'm assuming this is because the plugin requires TweenLite but its file doesn't import it. I've read that I could resolve this via the webpack.config file however I don't want to eject. Does anyone know another way around this?

Answer Source

Since its support for modules is broken and it currently seems to prioritize supporting systems like RequireJS over modern bundlers like Browserify and webpack, your best course of action might be to copy the library into the public folder and use it as a <script> tag in the HTML file. Then instead of importing, you would use it with browser globals.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download