码迷,mamicode.com
首页 > 其他好文 > 详细

ts自动编译

时间:2018-03-12 17:03:35      阅读:1891      评论:0      收藏:0      [点我收藏+]

标签:conf   配置   .json   选项   gpo   target   技术   arguments   orm   

webstorm typescript自动编译javascript配置:

1. 安装nodejs

2. 安装typescript编译器:

  npm install typescript -g

3. 配置webstorm:

  (1) 添加FileWatcher

    技术分享图片

    Program:tsc的路径

    Arguments:--sourcemap --target "ES5"

    Output paths to refush:$FileNameWithoutExtension$.js:$FileNameWithoutExtension$.js.map (注:参数一为ts文件生成的js的文件名,参数二生成源映射,可去掉)

    Working directory:$FileDir$

  (2)设置typescript编译选项:

    技术分享图片

  (3)编写tsconfig.json

{
"compilerOptions": {
"target": "es5",
"outDir": "bin-debug",
"experimentalDecorators": true,
"lib": [
"es5",
"dom",
"es2015.promise"
],
"types":[]
},
"exclude": [
"node_modules"
]
}
最后完成ts的编写后Ctrl+s都会自动生成js文件,文档结构图如下:

技术分享图片

 


 

    

ts自动编译

标签:conf   配置   .json   选项   gpo   target   技术   arguments   orm   

原文地址:https://www.cnblogs.com/chinayfhuang/p/8549427.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!