[英]Why does Angular build create files with 'es5' and 'es2015' but not 'es6' (or no suffix at all)?
[英]Angular 2 Quick Start VS 2015 with ES6
有沒有人有使用 ES6 的快速入門教程( https://angular.io/docs/ts/latest/cookbook/visual-studio-2015.html )的工作示例? 基本上,我想這樣做:
Typings.config(強調es6 ):
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true
}
}
當我這樣做並編譯時,我在 core-js 中得到重復的聲明錯誤,如下所示:
<path>\typings\globals\core-js\index.d.ts(3,14): error TS2300: Build:Duplicate identifier 'PropertyKey'.
如果我刪除 core-js,我可以編譯它,但它不能在 IE11 中工作(在 Edge、FF 和 Chrome 中工作)。 如果我將其更改為 es5,它也可以在 IE11 中運行。 我正在使用最新版本的 TypeScript (2.0)
有人可以解釋我做錯了什么嗎? 提前致謝。
看起來以下更改將在針對 es6 時使項目構建無錯誤。
將以下排除項添加到 tsconfig.js(core-js 是這里的重要一項):
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true
},
"compileOnSave": true,
"exclude": [
"node_modules",
"typings/index.d.ts",
"typings/globals/core-js"
]
}
安裝 jasmine 類型以獲取規范編譯:
typings install dt~jasmine --global --save
此外,該指南沒有提到從 starter 項目復制systemjs.config.js 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.