0

Hi I trying to organize my code by using requirejs, but I need to use a library that uses google-closure-compiler, the library is box2djs and you can get it from

https://github.com/leonidax/pl.git

I found that the code calls functions such as goog.require()

Hoy can I use this library by using RequireJS?

Leonox
  • 75
  • 7

2 Answers2

2

Oh, you're asking for a pile of hurt.

The closure library and the google dependency model (goog.require, etc) are tightly linked.

You're better moving to use the closure tools everywhere and trying to hack a composite solution.

Kevin Moore
  • 5,921
  • 2
  • 29
  • 43
1

I did get google closure library and RequireJS to work together. Just make sure the Closure stuff comes before the RequireJS stuff.

<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',
    ]);
dooderson
  • 547
  • 1
  • 9
  • 16