📜  带有 nodemon 的 typescript - TypeScript 代码示例

📅  最后修改于: 2022-03-11 14:48:14.557000             🧑  作者: Mango

代码示例3
watch that video, very useful

add this to your scripts object in package.json:

"start:ts": "tsc -w",
"start:js": "nodemon build/index.js",
"start": "concurrently npm:start:*"

in tsconfig.json uncomment "rootDir" and "outDir"
assuming your ts files will be in '/src' and
your js files compiled to '/build', change the configs to:

"rootDir": "./src", 
"outDir": "./build",

make sure you have typescript, nodemon, and concurrently installed either
in your project, or globally

then, in your project folder, run in terminal: 'npm start'