如何在Require.js中正确使用Create.js

时间:2018-02-27 21:36:50

标签: requirejs createjs

--------------------------- 试着用easejjs来使用requirejs ....这有效!

<head>
            <title>Trial Run</title>
            <link rel="stylesheet" type="text/css" href="mainStyle.css">
            <script src="http://code.createjs.com/1.0.0/easeljs.min.js"></script>
            <script src="http://code.createjs.com/1.0.0/tweenjs.min.js"></script>
            <script data-main="js/app" src="js/lib/require.js"></script>
    </head>

--------------------------- 当我删除带下划线的代码并设置'requirejs.config'(下面)时,     它失败了...'app.html:51 Uncaught ReferenceError:createjs未定义'

requirejs.config({
        "baseUrl": "js/lib",
        "paths": {
        "app": "../app",
        "easel": "//code.createjs.com/1.0.0/easeljs.min.js",
        "tween": "//code.createjs.com/1.0.0/tweenjs.min.js"
 },
 "shim": {
            "jquery.alpha": ["jquery"],
            "jquery.beta": ["jquery"],
            "easel": {
                exports: 'createjs'
            },
            "tween": {
                deps: ["easel"],
                exports: "Tween"
            }
 }

});

//加载主app模块以启动应用程序 requirejs([&#34;应用程序/主&#34;]);

--------------------------- Picture of File arrangement ---------------------------

1 个答案:

答案 0 :(得分:0)

语法错误,这有效!

requirejs.config({     “baseUrl”:“js / lib”,     “路径”:{         “app”:“.. / app”,         “画架”:'easeljs.min',         “tween”:'tweenjs.min'     },     “shim”:{         “jquery.alpha”:[“jquery”],         “jquery.beta”:[“jquery”],         画架:{             出口:'createjs'         },         补间:{             deps:['画架'],             出口:'补间'         }     } });

//加载主app模块以启动应用程序 requirejs([ “应用程序/主”]);