1

All definitions of glMatrix 2.2.0 seem to be undefined when included with RequireJS. However, on page inspection, it is being included in the HTML as a script tag.

However the same setup does work with glMatrix 1.3.7.

The require configuration is as follows:

require.config({
baseUrl: 'js/app',
paths: {
    jquery: '../lib/jquery',
    glm: '../lib/gl-matrix'
}
});

require(['main']);

And main.js looks like (jquery works in this instance):

define(function (require) {
var $ = require('jquery');
require('glm');

$(function () {
    var a = mat4.create();
    $('body').html("hello: " + a);
});
});

I also have the same problem with other global-namespace libraries like stats.js.

Although defining the scripts in HTML works, I would preferably like it to work with RequireJS for minimisation/concatenation.

<script src="js/lib/stats.js"></script>
<script src="js/lib/gl-matrix-min.js"></script>

Hopefully I'm missing something obvious with this one, as I'm tearing my hair.

Thanks in advance for any suggestions.

4

1 に答える 1