最近看到一篇用Visual Studio Code开发Angular2的文章,也是一篇入门教程,地址为:使用Visual Studio Code開發Angular 2專案。这里按部就班的做了一遍,感觉很方便,并且没有遇到楼主的一些问题,应该是安装环境有些不同。这里只为记录一下。再次感谢!

  一、随便新建一个目录,这里为:F:\Visual Studio Code\angular2_1,并用Visual Studio Code

  二、依次新建如下四个文件,参考https://angular.cn/docs/ts/latest/quickstart.html

    package.json 用来标记出本项目所需的 npm 依赖包。

         tsconfig.json 定义了 TypeScript 编译器如何从项目源文件生成 JavaScript 代码。

     typings.json 为那些 TypeScript 编译器无法识别的库提供了别的定义文件。

systemjs.config.js 为模块加载器提供了该到哪里查找应用模块的信息,并注册了所有必备的依赖包。 它还包括文档中后面的例子需要用到的包。

 1 {
 2   "name": "angular-quickstart",
 3   "version": "1.0.0",
 4   "scripts": {
 5     "start": "tsc && concurrently \"tsc -w\" \"lite-server\" ",
 6     "lite": "lite-server",
 7     "postinstall": "typings install",
 8     "tsc": "tsc",
 9     "tsc:w": "tsc -w",
10     "typings": "typings"
11   },
12   "license": "ISC",
13   "dependencies": {
14     "@angular/common": "~2.0.1",
15     "@angular/compiler": "~2.0.1",
16     "@angular/core": "~2.0.1",
17     "@angular/forms": "~2.0.1",
18     "@angular/http": "~2.0.1",
19     "@angular/platform-browser": "~2.0.1",
20     "@angular/platform-browser-dynamic": "~2.0.1",
21     "@angular/router": "~3.0.1",
22     "@angular/upgrade": "~2.0.1",
23     "angular-in-memory-web-api": "~0.1.1",
24     "bootstrap": "^3.3.7",
25     "core-js": "^2.4.1",
26     "reflect-metadata": "^0.1.8",
27     "rxjs": "5.0.0-beta.12",
28     "systemjs": "0.19.39",
29     "zone.js": "^0.6.25"
30   },
31   "devDependencies": {
32     "concurrently": "^3.0.0",
33     "lite-server": "^2.2.2",
34     "typescript": "^2.0.3",
35     "typings":"^1.4.0"
36   }
37 }
package.json

相关文章: