Tools
ts-node
基础的 project 配置文件,与 tsconfig 相同,只是添加了 ts-node 配置项
{// This is an alias to @tsconfig/node12: https://github.com/tsconfig/bases"extends": "../tsconfig.dev.json",// Most ts-node options can be specified here using their programmatic names."ts-node": {// It is faster to skip typechecking.// Remove if you want ts-node to do typechecking."transpileOnly": true,"files": true,"outDir": "./.ts-node","compilerOptions": {// compilerOptions specified here will override those declared below,// but *only* in ts-node. Useful if you want ts-node and tsc to use// different options with a single tsconfig.json.}},"compilerOptions": {// typescript options here}}
运行时检查配置,可用于查看文件是否被 include,执行以下:
如不设置 include,exlude ,fiels 等,也没啥问题,但是会导致很多无用的内容被解析造成编译速度变慢
ts-node --show-config
坑:ts-node 中如果配置了 files 为 true 时,会自动生成 files 配置,且该 files 中只包含与 confg.json 同层级及往内的内容。
所以如果需要指定一个外部文件进行执行(外部文件也有自己的依赖),需要 files 为 false。
transpileOnly 可以提速,因为会跳过类型检查。
