WebStorm配置typescript
2021-01-14 本文已影响0人
Augus_Einstein
概述见下图
![](https://img.haomeiwen.com/i7661680/7dd29babb41febc7.png)
1. Alt+Shift+S
open settings
![](https://img.haomeiwen.com/i7661680/e7d5ad406eee22c8.png)
Tools - File Watchers - new watcher(+)
Choose
<custom>
2. New File Watcher
![](https://img.haomeiwen.com/i7661680/ae9ef04ddb3431b5.png)
- Name
type your name
- File type choose
TypeScript
- Scope 为 server 路径
- Add Scope
local
thentype your name
step 2-2
- Add Scope
- Pattern
only add your server
仅自动编译 server - Program 为npm路径
C:\Users\Administrator\AppData\Roaming\npm\tsc
- Arguments
--sourcemap --target "ES5"
- Output paths to refresh
$FileNameWithoutExtension$.js:$FileNameWithoutExtension$.js.map
- Working directory
$FileDir$
- Advanced Options
default
3. Compile Part
![](https://img.haomeiwen.com/i7661680/dbe4cc8d8c709948.png)
COMPILE
only compile your server
close auto compile
- TypeScript type your path
~\AppData\Roaming\npm\node_modules\typescript
4. Add Configuration
![](https://img.haomeiwen.com/i7661680/2493e0200161df84.png)
Working directory input your server path
![](https://img.haomeiwen.com/i7661680/857bb11d4a877418.png)
JavaScript file: input
dist/app.js