So I have some generated JavaScript (from TypeScript):
define(["require", "exports", "three", "jquery", "./test"], function (require, exports, THREE, jQuery, Test) {
var Main = (function () {
function Main() {
this.container = jQuery('#test');
this.scene = new THREE.Scene();
...
This ends up with an error in the browser (on the last line of above):
Uncaught TypeError: Cannot read property 'Scene' of undefined
Interestingly jQuery has no problems; it's as if Three.js is simply not being loaded.
Require config:
requirejs.config({
baseUrl: "src",
paths: {
"main": "../main",
"test": "../test",
"three": "../three/three",
"sizzle": "/src/sizzle/dist/sizzle"
}
});
jQuery is in the 'js/src' folder, whereas Three.js is at 'js/three/three.js' (Express is being used so the js folder is hidden to the browser, and it doesn't seem to make any difference if I move three.js to the src folder). Sizzle is sitting on it's own because it was causing errors from being in a subfolder inside src.
Am I missing anything obvious about this? I have no leads
See Question&Answers more detail:os