hmi-web by
如果想用 vscode 编译、调试代码,必须全局安装 ts-node 和 nodemon
# install global pack with npm
npm i ts-node -g
npm i nodemon -g
若不想用 vscode,直接 npm install
# install dependencies module with npm
npm install
# build
npm run build
# start
npm run start
# watch
npm run watch-serve
# debugger
npm run debugger
- watch
/*
* --watch ./src 监听 ./src 目录下的所有文件
* -e ts,tsx 指定需要扩展的文件类型 ts 和 tsx,用逗号分隔
* --exec ts-node ./src/server.ts 执行 "ts-node ./src/server.ts" 命令
*/
nodemon --watch ./src -e ts,tsx --exec ts-node ./src/server.ts
- debugger
/*
* --exec node --inspect -r ts-node/register 执行 "node --inspect -r ts-node/register" 命令
* node --inspect -r ts-node/register 使用node预加载ts-node的register模块用来运行ts程序,并且开启debugger模式(调试协议为 inspector)。
*/
nodemon --watch ./src -e ts,tsx --exec node --inspect -r ts-node/register ./src/server.ts
MIT