ScrollMagic 和 Requirejs 错误

ScrollMagic & Requirejs error

我需要在我的项目中添加 scrollmagic.js whit requirejs

我的结构文件是

/js
   /app
      main.js
   /lib
      debug.addIndicators.js
      jquery.js
      require.js
      ScrollMagic.js
   app.js

我的app.js是

requirejs.config({
    "baseUrl": "js/lib",
    "paths": {
        "app": "../app"

    },

});

requirejs(["jquery"]);
requirejs(["app/main"]);
requirejs(["ScrollMagic"]);
requirejs(["debug.addIndicators"]);

正在加载头部脚本

<head>
    <script data-main="js/app" src="js/lib/require.js"></script>
    <script type="text/javascript" charset="utf-8" async="" data-requirecontext="_" data-requiremodule="app" src="js/app.js"></script>
    <script type="text/javascript" charset="utf-8" async="" data-requirecontext="_" data-requiremodule="jquery" src="js/lib/jquery.js"></script>
    <script type="text/javascript" charset="utf-8" async="" data-requirecontext="_" data-requiremodule="app/main" src="js/lib/../app/main.js"></script>
    <script type="text/javascript" charset="utf-8" async="" data-requirecontext="_" data-requiremodule="ScrollMagic" src="js/lib/ScrollMagic.js"></script>
</head>

我的main.js是

define(['jquery'], function() {
jQuery(document).ready(function($) {

    jQuery(function() { // wait for document ready
        // init controller
        var controller = new ScrollMagic.Controller({ loglevel: 3 });

        // build scene
        var scene = new ScrollMagic.Scene({ triggerElement: "#trigger", duration: 300, loglevel: 3 })
            .setPin("#target")
            .addIndicators() // add indicators (requires plugin)
            .addTo(controller);

    });
});


});

Into inspector 我有这个错误,ScrollMagic 不工作

main.js:6 Uncaught ReferenceError: ScrollMagic is not defined
    at HTMLDocument.<anonymous> (main.js:6)
    at j (jquery.js:2)
    at Object.fireWith [as resolveWith] (jquery.js:2)
    at ready (jquery.js:2)

我也试过更改 main.js

中的定义
define(['jquery','ScrollMagic','debug.addIndicators'], function() {

同样的错误进入检查器

您必须像这样在 main.js 中导入 ScrollMagic:

define(['jquery', '/path/scrollmagic'], function(jQuery, ScrollMagic) {
   ....
   ....
});