首页 > 解决方案 > 反应 + gsap + scrollMagic

问题描述

这是一个代码框: https ://codesandbox.io/s/greensock-and-scrollmagic-with-react-gmidc 我将 React 与 GSAP 和 ScrollMagic 一起使用。但是当我在本地主机上运行代码时,会出现一个错误:

animation.gsap.js:32 Uncaught Error: Cannot find module 'ScrollMagic'
    at webpackMissingModule (animation.gsap.js:32)
    at animation.gsap.js:32
    at Object../node_modules/scrollmagic/scrollmagic/uncompressed/plugins/animation.gsap.js (animation.gsap.js:43)
    at __webpack_require__ (bootstrap:785)
    at fn (bootstrap:150)
    at Module../src/index.js (import-fonts.css?480e:37)
    at __webpack_require__ (bootstrap:785)
    at fn (bootstrap:150)
    at Object.0 (typography.css?5564:37)
    at __webpack_require__ (bootstrap:785)
    at checkDeferredModules (bootstrap:45)
    at Array.webpackJsonpCallback [as push] (bootstrap:32)
    at main.chunk.js:1

任何帮助,将不胜感激

标签: reactjsgsapscrollmagic

解决方案


最终的工作答案在这里:https ://github.com/janpaepke/ScrollMagic/issues/842


推荐阅读