我在 creatJS
方面遇到问题,希望您能提供帮助。
var stage = new createjs.Stage(canvas);
我收到此错误:
angular.js:13642 ReferenceError: createjs is not defined. even thought i get the EaselJS in my bower-components.
谢谢
最佳答案
我遇到了类似的问题 - 在我的例子中我添加了 createjs-module webpack 的 npm 包(我在 Laravel wabpack mix 中使用它)。看来范围存在问题,所以我必须确保 createjs 是全局的。因此您可以尝试执行以下操作:
安装 npm 模块(在控制台中)
npm install createjs-module --save
初始化createjs(在你的js文件中)
this.createjs = {};
使 createjs 全局化(在您的 js 文件中)
window.createjs = this.createjs;
导入模块(在您的 js 文件中)
require('createjs-module');
现在您可以像往常一样使用它了:)
关于javascript - 我在 CreateJS : "createjs is not defined" 中收到错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38593064/