2016-12-17 76 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,适合初学者。