2012-06-05 74 views
0

我喜尝试使用requirejs来组织我的代码的第三方库,但我需要使用一个使用谷歌闭合编译库,该库是box2djs,你可以从使用与requirejs

https://github.com/leonidax/pl.git得到它

我发现代码调用函数,如goog.require()

霍伊我可以用用RequireJS这个库?

回答

2

哦,你要求一堆伤害。

封闭库和google依赖模型(goog.require等)是紧密关联的。

你最好转向在各处使用闭包工具并试图破解复合解决方案。

1

我没有得到谷歌封闭库和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', 
    ]);