[英]Using 3rd party libraries with requirejs
嗨,我尝试使用requirejs组织代码,但我需要使用使用google-closure-compiler的库,该库为box2djs,您可以从中获取它
https://github.com/leonidax/pl.git
我发现代码调用了goog.require()之类的函数
可以通过RequireJS使用此库吗?
哦,你要受伤了。
闭包库和google依赖模型(goog.require等)紧密相连。
您最好在所有地方使用封闭工具,并尝试破解复合解决方案。
我确实得到了谷歌关闭库和RequireJS一起工作。 只要确保Closure东西在RequireJS东西之前即可。
<script src='../externalJS/requirejs/require.js'></script>
<script src="../externalJS/closure-library-read-only/closure/goog/base.js"></script>
<script>
goog.require('goog.structs');
goog.require('goog.structs.PriorityQueue');
// i just had to make sure that the closure lib stuff came before the requirejs stuff
requirejs([
'loaders_parsers/requiredLibrarys',
]);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.