【发布时间】:2019-02-01 06:37:42
【问题描述】:
我正在使用 TypeScript 创建我的 nodejs 应用程序,该应用程序运行良好,因为 index.ts 正在成功编译和执行,但子文件夹中的 TypeScript 文件被忽略并且不构成开发监视的一部分。
有人可以帮忙吗?我使用yarn start 在开发模式下运行我的应用程序。我来自package.json 的脚本如下所示:
"scripts": {
"start": "yarn run build:live",
"build": "rm -rf dist && tsc",
"build:live": "nodemon --exec ./node_modules/.bin/ts-node -- ./src/index.ts"
}
而我的tsconfig.json 看起来像这样:
{
"compilerOptions": {
"outDir": "dist",
"target": "es2017",
"module": "commonjs",
"sourceMap": true,
"noUnusedLocals": true,
"typeRoots": [
"node_modules/@types"
]
},
"include": [
"src/**/**.ts",
"test/**/**.ts"
],
"exclude": [
"node_modules"
]
}
我曾尝试使用"build:live": "nodemon --exec ./node_modules/.bin/ts-node --project tsconfig.json" 作为我的开发脚本,但这会导致编译器挂起。
【问题讨论】:
标签: node.js typescript nodemon ts-node