2016-03-28 14 views
1

js'yi js'ye aktarmak için gulp kullanıyorum ve ts dosyalarım diğer statik kaynaklarla birlikte doğru klasörde üretiliyor.Açısal2 önyükleme yapamaz - cosole'de hata yok

//tsconfig.js 

    { 
     "compilerOptions": { 
     "outFile": "scripts.js", //this can be commented to retain the original file structure instead of concatenating into one file 
     "target": "es5", 
     "module": "system", 
     "moduleResolution": "node", 
     "sourceMap": true, 
     "emitDecoratorMetadata": true, 
     "experimentalDecorators": true, 
     "removeComments": false, 
     "noImplicitAny": false 
     }, 
     "exclude": [ 
     "gulpfile.js", 
     "node_modules", 
     "typings/main", 
     "typings/main.d.ts" 
     ] 
    } 

Ben systemjs

//index.html 

     <!DOCTYPE html> 
     <html> 
     <head> 
      <base href="/"> 
      <meta charset="UTF-8"> 
      <title>ZEFR</title> 

      <link href='https://fonts.googleapis.com/css?family=Open+Sans:400,300,300italic,700,600,700italic,400italic,600italic,800,800italic' rel='stylesheet' type='text/css'> 

      <link rel="stylesheet" type="text/css" href="style.css"> 
     </head> 
     <body> 
      <my-app>Loading</my-app> 
     </body> 
     <script src="lib/es6-shim.js"></script> 
     <script src="lib/angular2-polyfills.js"></script> 
     <script src="lib/system.src.js"></script> 
     <script src="lib/Rx.js"></script> 
     <script src="lib/angular2.dev.js"></script> 
     <script src="lib/router.dev.js"></script> 

     <script> 
     System.config({ 
      packages: { 
       dist: { 
        format: 'register', 
        defaultExtention: 'js' 
       } 
      } 
     }); 
     System.import('scripts.js') 
       .then(null, console.error.bind(console)) 
    </script> 
    </html> 

script.js benim birleştirilmiş javascript dosyaları kullanarak scripts.js içe ve tüm bileşenleri içerir. Sorun şu ki konsolda herhangi bir sorun yok. Bir script.js yerine boot.js'yi hedeflemem gerektiğini hissediyorum. Nasıl dist klasörüne

//my project folder structure 

    -public/ 
     -index.html 
     -components/ 
     -boot/ 
      -boot.ts 
     -app/ 
      -app.component.ts 
     ... 
     -dist/ 
     -scripts.js //this is the concatenated file of all the js transpiled from ts 
     -style.css 
     -images/ 
     -lib/ 
+0

Transpiling yaparken aynı klasör yapısını koruyarak denedim. Dist, ilgili ts dosyalarının js dosyalarını içerir. Hala hayır şans. Aynı yükleme .... ekran –

cevap

0

Bu size yardımcı gerektiğini yapabilirsiniz: İşaret üst dizinde iken

System.import('dist/scripts') 
      .then(null, console.error.bind(console)) 

Sizin scripts.js

, dist olduğunu. Ve orada ---.js eklemeniz gerekmez.

+0

evet bunu denedim, bana mantıklı. Ama bu bana angular2-pollyfills.js içinde bir hata veriyor: "http: localhost: 3000/dist/scripts.js yükleniyor –

+0

, system.js 'yi index.html – uksz

+0

dizinindeki polyfill'lerin üzerine yerleştirmeyi denemeyin: –