所以我有一些生成的JavaScript(来自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();
...
Run Code Online (Sandbox Code Playgroud)
这最终导致浏览器出错(在上一行):
Uncaught TypeError: Cannot read property 'Scene' of undefined
Run Code Online (Sandbox Code Playgroud)
有趣的是jQuery没有问题; 好像Three.js根本没有加载.
需要配置:
requirejs.config({
baseUrl: "src",
paths: {
"main": "../main",
"test": "../test",
"three": "../three/three",
"sizzle": "/src/sizzle/dist/sizzle"
}
});
Run Code Online (Sandbox Code Playgroud)
jQuery位于'js/src'文件夹中,而Three.js位于'js/three/three.js'(正在使用Express,因此浏览器隐藏了js文件夹,它似乎没有如果我将three.js移动到src文件夹中的区别).Sizzle坐在它自己身上,因为它导致错误来自src内的子文件夹.
我错过了任何明显的事吗?我没有线索