我正在尝试让 ScrollMagic 与 ES2015 导入和 React 一起使用。我收到此错误:
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
这就是我导入所有内容的方式。
import {gsap, TimelineMax, TweenMax} from 'gsap';
import ScrollMagic from 'ScrollMagic';
require('scrollmagic/scrollmagic/uncompressed/plugins/animation.gsap');
最佳答案
使用此 import
语句对我有用:
import * as ScrollMagic from 'scrollmagic'
使用npm install rollmagic
安装软件包后。
关于reactjs - ScrollMagic 与 React,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36853288/