2016-12-17 53 views
2

我試圖部署在第一時間local IISangular2-quickstart應用和新的生產準備構建過程。由於我是部署過程的新手,請隨身攜帶。部署angular2,快速啓動應用到IIS

我的快速入門應用運行良好。

我添加一飲而盡到我的項目,我正在與一飲而盡做的是,

enter image description here

1)創建DIST文件夾中根目錄dist

2)轉換所有.ts.js並把它們dist/app

3)創建dist/libs含有reflect.js下,shim.min.jssystem.src.js,zone.js如圖所示。

4)systemjs.config.js情況如下(P 租賃注我做不改變現有的文件尚未),

/** 
* System configuration for Angular samples 
* Adjust as necessary for your application needs. 
*/ 
(function (global) { 
    System.config({ 
    paths: { 
     // paths serve as alias 
     'npm:': 'node_modules/' 
    }, 
    // map tells the System loader where to look for things 
    map: { 
     // our app is within the app folder 
     app: 'app', 

     // angular bundles 
     '@angular/core': 'npm:@angular/core/bundles/core.umd.js', 
     '@angular/common': 'npm:@angular/common/bundles/common.umd.js', 
     '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js', 
     '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js', 
     '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js', 
     '@angular/http': 'npm:@angular/http/bundles/http.umd.js', 
     '@angular/router': 'npm:@angular/router/bundles/router.umd.js', 
     '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js', 

     // other libraries 
     'rxjs':      'npm:rxjs', 
     'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js' 
    }, 
    // packages tells the System loader how to load when no filename and/or no extension 
    packages: { 
     app: { 
     main: './main.js', 
     defaultExtension: 'js' 
     }, 
     rxjs: { 
     defaultExtension: 'js' 
     } 
    } 
    }); 
})(this); 

5)index.html如下,

<!DOCTYPE html> 
<html> 
    <head> 
    <title>Angular QuickStart</title> 
    <meta charset="UTF-8"> 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <link rel="stylesheet" href="styles.css"> 



    <!-- changed this section with libs --> 


     <script src='lib/shim.min.js'></script> 
     <script src='lib/zone.js'></script> 
     <script src='lib/Reflect.js'></script> 
     <script src='lib/system.src.js'></script> 
     <script src="https://ajax.googleapis.com/ajax/libs/hammerjs/2.0.8/hammer.min.js"></script> 
     <script src="systemjs.config.js"></script> 

     <script> 
     System.import('app').catch(function(err){ console.error(err); }); 
     </script> 



    </head> 

    <body> 
    <my-app>Loading AppComponent content here ...</my-app> 
    </body> 
</html> 

6)我複製dist folder's內容c:/inetpub/wwwroot並嘗試訪問localhostchrome browser,我看到下面的瀏覽器的控制檯。

enter image description here

7)我知道它的不完整的過程,但我想完成它,不知道需要什麼其他的事情。


現在的問題是

1)我需要在systemjs.config.js改變什麼?如果是,什麼?

2)正如你可以看到systemjs.config.js使用node_modules,爲angular2 dependencies做什麼?

3)什麼其他依賴像jqueryhummerjs和等?

4)因爲我不打算在dist文件夾node_modules文件夾,那node_modules文件夾?

5)哪些其他文件需要在dist folders

回答

0

我只是需要node_modules文件夾複製到c:/inetpub/wwwroot/和繁榮。現在它的工作如預期。

所以最後我c:/inetput/wwwroot文件夾中包含文件夾下成功運行angular2應用,

應用
| _______ app.component.js
| _______ app.module.js
| _______ main.js

lib
| _______ Reflect.js
| _______ shim.min.js
| _______ system.src.js
| _______ zone.js

node_modules(just copy paste
的index.html(changed script's path, refer above index.html
systemjs.config.js(no change

-1

它將更好,如果我們使用任務亞軍爲我們做這樣的事情, 我正在尋找gulp配置和npm腳本來快速發佈應用程序。

所以Angular2 QuickStart應該有npm腳本,例如npm run deploy,適合初學者。