0
我有我的JSPM Build
以下配置使用打字稿编译:JSPM Builder:如何依赖其他模块?
var Builder = require('jspm').Builder;
var builder = new Builder('.');
builder.reset();
builder.loadConfig('./jspm.conf.js')
.then(function() {
builder.config({
defaultJSExtensions: false,
transpiler: "typescript",
typescriptOptions: {
"module": "system",
"experimentalDecorators": true,
"resolveAmbientRefs": true
},
packages: {
"source": {
"main": "app/index",
"defaultExtension": "ts",
"meta": {
"*.ts": {
"loader": "ts"
},
"*.css": {
"loader": "css"
}
}
}
},
packageConfigPaths: [
"npm:@*/*.json",
"npm:*.json",
"github:*/*.json"
],
meta: {
"three": {
"format": "global",
"exports": "THREE"
},
"three-firstpersoncontrols": {
"deps": "three"
}
},
map: {
"three": "github:mrdoob/[email protected]/build/three.js",
"three-firstpersoncontrols": "github:mrdoob/[email protected]/examples/js/controls/FirstPersonControls.js"
}
});
var promises = new Array();
promises.push(builder.buildStatic('source', './build/js/app.min.js', {
sourceMaps: false,
minify: true,
mangle: false
}));
return Promise.all(promises);
})
.then(function() {
cb();
})
.catch(function(err) {
console.log('Build Failed. Error Message: ', err);
});
我试图用含有例如功能单独的文件一起使用THREE.js
库FirstPersonControls
。路径在map
部分中定义,并且这些都工作得很好。
捆绑后,我得到的消息是THREE.FirstPersonControls is not a contructor
。目前我的猜测是,单独模块three-firstpersoncontrols
不依赖于全局THREE
变量,因此无法调用构造函数THREE.FirstPersonControls
。
所以我的问题是:
如何让这些单独的模块依赖我的全球THREE
模块上构建?