ts-node-dev

比 nodemon更好的实现热更新, 它会缓存 tsc 的编译过程

tsc-alias

替换@别名路径

tsconfig-paths

tsc在编译代码时不会去把路径别名替换成对应的相对路径,解决找不到对应的模块

cross-env

cross-env:运行跨平台设置和使用环境变量的脚本, 能够提供一个设置环境变量的scripts, 让你能够以unix方式设置环境变量,然后在windows上也能兼容运行。

  1. {
  2. "scripts": {
  3. "dev": "tsnd -r tsconfig-paths/register --respawn ./index.ts",
  4. "start": "cross-env TS_NODE_BASEURL=./dist node -r tsconfig-paths/register .\\dist\\index.js",
  5. "build": "tsc && tsc-alias"
  6. },
  7. }