NestJS - 在监视模式下排除文件夹

use*_*401 7 nestjs

我在根目录中创建了一个公共文件夹来存储用户上传的文件。但是在npm run start:dev模式下,每次上传文件时,Nest 都会检测到文件更改并重新启动服务器。我该怎么做才能避免这种情况?谢谢。

目录结构:

-project
 -dist
 -src
 -public
 -(other files)
Run Code Online (Sandbox Code Playgroud)

Pri*_*abo 16

tsconfig.json下面的属性之后立即包含以下exclude属性

  "include": [ "src"]
Run Code Online (Sandbox Code Playgroud)

  • 这是正确的,仅添加“exclude”是不够的 (2认同)

RAM*_*RAM 5

内部tsconfig.json文件执行我在以下示例中所做的操作:

{
  "compilerOptions": {
    "module": "commonjs",
    "declaration": true,
    "removeComments": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es2017",
    "sourceMap": true,
    "outDir": "./dist",
    "baseUrl": "./",
    "incremental": true,
    "paths": {

    }
  },
  "exclude": [
    "node_modules",
    "dist",
    "public"   <<-- Add the folder name here to exclude from updates
  ]
}
Run Code Online (Sandbox Code Playgroud)

  • 这不起作用 (7认同)