配置崇高3构建打字稿 [英] Configuring Sublime 3 to Build TypeScript
问题描述
我下面的AngularJS 开始使用崇高指南。当我尝试编译,我得到以下错误:
/Users/Audrey/MyDev/node/07tsdemo/app.ts(2,1):错误TS1148:除非提供了--module'标志不能编译模块。
/Users/Audrey/MyDev/node/07tsdemo/app.ts(4,1):错误TS1205:装饰瞄准的ECMAScript 5及更高版本时才可用。
/Users/Audrey/MyDev/node/07tsdemo/app.ts(11,7):错误TS1219:用于装饰实验的支持是一个特点,就是在将来的版本中改变。指定--experimentalDecorators删除此警告。
[完成了2.2S,退出code 2]
[命令:['TSC','/Users/Audrey/MyDev/node/07tsdemo/app.ts']
[导演:/用户/奥黛丽/ mydev的/节点/ 07tsdemo]
[路径:在/ usr / bin中:/ bin中:/ usr / sbin目录:/ sbin目录]
的另一个问题是,它似乎升华不能识别的路径和导入正常。它显示我在编辑器中的一些错误。我该如何配置这使它工作?非常感谢你!
- 在 GitHub的 样品
-
tsconfig.json
{
compilerOptions:{
出来:建/ out.js
sourceMap:真实,
目标:ES5
},
文件:
app.ts
]
}
让你在升华配置TS编译器?
1错误:提供模块标志编译器。例如: TSC -m CommonJS的
。 (编译器选项)。
第二个错误:目标ECMAScript5 -t ES5
。默认情况下,编译器目标的ECMAScript 3,目前的prevailing标准。
3的错误:添加--experimentalDecorators标志编译器。
我已经下载从NG-conf的样品和应用这个tsconfig(适用于Windows):
{
CMD:台糖,$文件]
路径:C:/用户/ Artiom / AppData的/漫游/ NPM
compilerOptions:{
emitDecoratorMetadata:真实,
experimentalDecorators:真实的,//添加到您的配置。
模块:CommonJS的
目标:ES5
}
}
更新
1号红色下划线:找不到模块'angular2 / angular2的
第二:红色线下:您配置未命中 experimentalDecorators
。我告诉你在原来的答案添加此。看看到我的 tsconfig.json
I am following the AngularJS start guide using Sublime. When I try to compile, I get the following error:
/Users/Audrey/MyDev/node/07tsdemo/app.ts(2,1): error TS1148: Cannot compile modules unless the '--module' flag is provided.
/Users/Audrey/MyDev/node/07tsdemo/app.ts(4,1): error TS1205: Decorators are only available when targeting ECMAScript 5 and higher.
/Users/Audrey/MyDev/node/07tsdemo/app.ts(11,7): error TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Specify '--experimentalDecorators' to remove this warning.
[Finished in 2.2s with exit code 2]
[cmd: ['tsc', '/Users/Audrey/MyDev/node/07tsdemo/app.ts']]
[dir: /Users/Audrey/MyDev/node/07tsdemo]
[path: /usr/bin:/bin:/usr/sbin:/sbin]
The other problem is that it seems sublime can't recognize the path and import properly. It's showing me some error in the editor. How can I config this to make it work? Thank you very much!!!
- Sample on GitHub
tsconfig.json
{ "compilerOptions": { "out": "built/out.js", "sourceMap": true, "target": "es5" }, "files": [ "app.ts" ] }
Have you configured TS compiler in sublime?
1st error: Provide module flag to compiler. Ex: tsc -m commonjs
. (Compiler Options).
2nd error: Target ECMAScript5 -t es5
. By default the compiler targets ECMAScript 3, the current prevailing standard.
3rd error: Add --experimentalDecorators flag to compiler.
I've downloaded sample from ng-conf and applied this tsconfig (for Windows):
{
"cmd": ["tsc","$file"],
"path": "C:/Users/Artiom/AppData/Roaming/npm",
"compilerOptions": {
"emitDecoratorMetadata": true,
"experimentalDecorators": true, //add this to your config.
"module": "commonjs",
"target": "es5"
}
}
Update
1st red underline: Cannot find module 'angular2/angular2'
2nd:red under line: Your config misses experimentalDecorators
. I've told you to add this in original answer. Take a look into my tsconfig.json
这篇关于配置崇高3构建打字稿的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!