javascript - Loading CreateJS with RequrieJS. "shim" option dosen't work -


in requirejs config have

require.config({     baseurl: "js",     paths: {         react: "libs/react/" + (debug ? "react" : "react.min"),         domready: "libs/require/plugins/domready.min",         superagent: "libs/superagent/superagent.min",         createjs: "libs/createjs/createjs.min" //combined createjs lib      },     shim: {         createjs: { exports: "createjs" }     },     waitseconds: 0 }); 

then want require createjs dependency of module

define(     [         "react",         "createjs",         "config",         "common"     ],     function(react, createjs, config, common) {         console.log(createjs); //didn't work. returning empty require module object         console.log(createjs); //proper createjs object     } ); 

createjs not actual representation of global variable createjs. shim option nothing. result without shim same

fiddling around, found in combined version of createjs, there definition of json3 module. module you've got dependency, not full createjs. use requirejs , createjs, see this example need require easel, tween , other modules separately.


Comments