2016-08-19 3 views
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モジュールに依存せてはどうすればよいですか?今設定になっており、

typescriptOptions: { 
    "module": "system", // <-- THIS LINE 
    "experimentalDecorators": true, 
    "resolveAmbientRefs": true 
} 

私は仕事にsystemからamdに私のモジュール形式を変更する必要がありました:

答えて

0

は、しばらくして、私はこの問題は、この部分とあったが分かった

typescriptOptions: { 
    "module": "amd", 
    "experimentalDecorators": true, 
    "resolveAmbientRefs": true 
} 

うまくいけば、この問題の他の誰でもこの回答を使用できます。

関連する問題