admin管理员组文章数量:1402280
I'm having trouble using the fabric.js library with a Meteor app, and unfortunately I can't quite get past the stage of adding it to my app, much less invoking it. The easiest recreation is as follows:
> mrt create test
> cd test
> mkdir client
> curl -o ./client/all.js .js/1.2.0/fabric.all.min.js
> mrt
Going to localhost:3000 shows the following console output:
Uncaught TypeError: Cannot read property 'object' of undefined all.js:4074
global.fabric.global.fabric all.js:4074
(anonymous function) all.js:4936
(anonymous function)
And line 4074 of all.js is the second line here:
var fabric = global.fabric || (global.fabric = { }),
extend = fabric.util.object.extend,
capitalize = fabric.util.string.capitalize,
clone = fabric.util.object.clone,
toFixed = fabric.util.toFixed,
multiplyTransformMatrices = fabric.util.multiplyTransformMatrices;
I'm pretty certain I'm doing something wrong (as opposed to the problem being with fabric or meteor) but I'm not sure where. I've also tried placing the all.js file into my public directory and, while that doesn't throw the same TypeError, it does make it so that the fabric variable seems to be unavailable anywhere in my code.
Any help with properly loading fabric.js into my app would be great.
I'm having trouble using the fabric.js library with a Meteor app, and unfortunately I can't quite get past the stage of adding it to my app, much less invoking it. The easiest recreation is as follows:
> mrt create test
> cd test
> mkdir client
> curl -o ./client/all.js http://cdnjs.cloudflare./ajax/libs/fabric.js/1.2.0/fabric.all.min.js
> mrt
Going to localhost:3000 shows the following console output:
Uncaught TypeError: Cannot read property 'object' of undefined all.js:4074
global.fabric.global.fabric all.js:4074
(anonymous function) all.js:4936
(anonymous function)
And line 4074 of all.js is the second line here:
var fabric = global.fabric || (global.fabric = { }),
extend = fabric.util.object.extend,
capitalize = fabric.util.string.capitalize,
clone = fabric.util.object.clone,
toFixed = fabric.util.toFixed,
multiplyTransformMatrices = fabric.util.multiplyTransformMatrices;
I'm pretty certain I'm doing something wrong (as opposed to the problem being with fabric or meteor) but I'm not sure where. I've also tried placing the all.js file into my public directory and, while that doesn't throw the same TypeError, it does make it so that the fabric variable seems to be unavailable anywhere in my code.
Any help with properly loading fabric.js into my app would be great.
Share Improve this question asked Jul 7, 2013 at 17:10 IanWhalenIanWhalen 82112 silver badges30 bronze badges1 Answer
Reset to default 9Would you please try to put the library file into the client/patibility subdirectory. Any javascript files imported in Meteor is wrapped in closure in which you cannot easily access the global scope. client/patibility is the place that no closure would be applied to the library.
http://docs.meteor./#structuringyourapp you can find more talking about the importing library issue here.
本文标签: Unable to load javascript library into Meteor appStack Overflow
版权声明:本文标题:Unable to load javascript library into Meteor app - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744281555a2598677.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论