1.安装
- 首先你要已经安装了Node.js
- 然后安装ts:npm install -g typescript
2.配置环境
- 安装完成后在WebStorm中开启TypeScript Compiler编译器
- 在 Command line options中添加–module commonjs(这样工程中才可以使用import,否则会报错:Cannot compile external modules unless the’–module’ flag is provided. )
- –outDir xxx 是设置编译器自动生成.js的目录