[我的src/
文件夹的子目录内的文件被更改时,nodemon
不会对其更改做出反应,但是当项目中的其他文件被更改时它会做出反应。
Screenshot of the folder structure
package.json
:
"dev": "nodemon src/server.ts",
nodemon.json
:*
{
"watch": [".babelrc", "public/locales/**/*.json", "next.config.js", "src/server.ts"],
"exec": "ts-node --project tsconfig.server.json"
}
ts.config.server.json
:
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"target": "es2017",
"noEmit": false,
"outDir": "build/"
},
"include": ["src/server.ts"]
}
和ts.config.json
:
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"jsx": "preserve",
"lib": ["dom", "es2017"],
"baseUrl": ".",
"moduleResolution": "node",
"strict": true,
"allowJs": true,
"noEmit": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"skipLibCheck": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"isolatedModules": true,
"removeComments": false,
"preserveConstEnums": true,
"sourceMap": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true
},
"exclude": ["dist", ".next", "out", "next.config.js"],
["next-env.d.ts", "**/*.ts", "**/*.tsx"]
}
在nodemon.json中,尝试更改此内容:
"watch": [".babelrc", "public/locales/**/*.json", "next.config.js", "src/server.ts"],
至此:
"watch": [".babelrc", "public/locales/**/*.json", "next.config.js", "src/**/*.ts"],