nodemon为什么不对我的src /文件夹中的更改做出反应?

问题描述 投票:1回答:1

[我的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"]
}
reactjs typescript next.js nodemon
1个回答
0
投票

在nodemon.json中,尝试更改此内容:

"watch": [".babelrc", "public/locales/**/*.json", "next.config.js", "src/server.ts"],

至此:

"watch": [".babelrc", "public/locales/**/*.json", "next.config.js", "src/**/*.ts"],
© www.soinside.com 2019 - 2024. All rights reserved.