简体   繁体   English

带有 GSAP 的 ScrollMagic - 在 animation.gsap.js 中找不到这些依赖项

[英]ScrollMagic with GSAP - These dependencies were not found in animation.gsap.js

I am trying to use GSAP and ScrollMagic in one of my projects however, when I try and require animation.gsap.js my compiler keeps throwing the following error;我试图在我的一个项目中使用 GSAP 和 ScrollMagic 但是,当我尝试并要求animation.gsap.js我的编译器不断抛出以下错误;

These dependencies were not found:                                                                                                                                                                                                                                                     friendly-errors 14:54:44
                                                                                                                                                                                                                                                                                       friendly-errors 14:54:44
* TimelineMax in ./node_modules/scrollmagic/scrollmagic/uncompressed/plugins/animation.gsap.js                                                                                                                                                                                         friendly-errors 14:54:44
* TweenMax in ./node_modules/scrollmagic/scrollmagic/uncompressed/plugins/animation.gsap.js   

I am using a plugin inside NuxtJS to require these plugins.我在 NuxtJS 中使用了一个插件来要求这些插件。 GSAP itself works fine and ScrollMagic works fine separately. GSAP 本身工作正常,而 ScrollMagic 单独工作正常。 However, when it comes to using the GSAP plugin for Scroll Magic it doesn't seem to be working.但是,当涉及到使用 GSAP 插件进行 Scroll Magic 时,它似乎不起作用。

Plugin.js插件.js

import Vue from 'vue'
import Navigation from '../components/Navigation.vue'
import {TweenMax, Power2, TimelineLite, TimelineMax, TweenLite} from "gsap"
import ScrollMagic from 'scrollmagic';
require("scrollmagic/scrollmagic/uncompressed/plugins/animation.gsap");

export default () => {
    Vue.component('navigation', Navigation);
}

 

Does anyone have any ideas as to why this might not be working?有没有人对为什么这可能不起作用有任何想法?

Thank you in advance!先感谢您!

UPDATE: This is fixed in the latest version of GSAP更新:这是在最新版本的 GSAP 中修复的

I think you're importing GSAP wrong.我认为您导入 GSAP 是错误的。 Try:尝试:

import {TweenMax, Power2, TimelineLite, TimelineMax, TweenLite} from "gsap/TweenMax"

See NPM docs for further info: https://www.npmjs.com/package/gsap#npm有关更多信息,请参阅 NPM 文档: https : //www.npmjs.com/package/gsap#npm

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM