Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ScrollMagic with React

I'm trying to get ScrollMagic working with ES2015 import and React. I'm getting this error:

ERROR in ./~/scrollmagic/scrollmagic/uncompressed/plugins/animation.gsap.js
Module not found: Error: Cannot resolve module 'TimelineMax' in /Users/dillonraphael/Desktop/marbleshark_landingpage/node_modules/scrollmagic/scrollmagic/uncompressed/plugins
 @ ./~/scrollmagic/scrollmagic/uncompressed/plugins/animation.gsap.js 31:2-61

This is how I'm importing everything.

import {gsap, TimelineMax, TweenMax} from 'gsap';
import ScrollMagic from 'ScrollMagic';
require('scrollmagic/scrollmagic/uncompressed/plugins/animation.gsap');
like image 664
Dileet Avatar asked Jun 30 '26 11:06

Dileet


1 Answers

Using this import statement works for me:

import * as ScrollMagic from 'scrollmagic'

after installing the package with npm install scrollmagic.

like image 65
Huy Nguyen Avatar answered Jul 02 '26 00:07

Huy Nguyen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!