Skip to content

初始化配置

vs配置:

第一步:tsc --init  生成tsconfig.json 文件

第二步:修改json里面outDir 为./js

第三步:点击终端 。 运行任务  监视json

搭建运行环境

npm i typescript -g

npm i ts-node -g

目录结构

package.json   -->npm init  | npm init -y
tsconfig.json  -->tsc --init
src   |        -->开发阶段
      xxx.ts   -->初始化整个项目的
      xxxx.ts    -->来完成对于xxx的验证
      xxxx.ts     -->来完成对于xxx的验证
build |        -->生产阶段
      script.js

多个ts打包合成一个js

进入tsconfig.json
把module 改成"module": "amd"
入口路径改成"rootDir": "./src"
出口路径改成"outDir": "./build"
出口js改成"outFile": "./build/script.js"