gpt4 book ai didi

node.js - NestJS 阻止服务器在开发中重新加载

转载 作者:行者123 更新时间:2023-12-02 19:33:49 25 4
gpt4 key购买 nike

我有一个在 public 目录中创建一个新文件夹的路线,该文件夹是由 app.useStaticAssets 提供的静态内容。

问题是,即使我在 tsconfig.build.jsontsconfig 的 exclude 数组中添加了 public 目录.json,当在 public 目录中删除或创建新文件夹时,我的服务器仍会在开发过程中重新加载。

我错过了什么?

更新:tsconfig.json

{
"compilerOptions": {
"module": "commonjs",
"declaration": true,
"removeComments": true,
"noImplicitAny": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"esModuleInterop": true,
"target": "es2017",
"sourceMap": true,
"outDir": "./dist",
"baseUrl": "./",
"incremental": true
},
"exclude": ["node_modules", "dist", "public"]
}

我提到public文件夹位于src文件夹之外。他们处于同一水平。

最佳答案

我能够重现此问题,并发现这似乎是一个常见问题 -> https://github.com/nestjs/nest/issues/3510

正如 github 问题中所提出的,添加 include 作为解决方法似乎可以解决问题:

{
"compilerOptions": {
"module": "commonjs",
"declaration": true,
"removeComments": true,
"noImplicitAny": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"esModuleInterop": true,
"target": "es2017",
"sourceMap": true,
"outDir": "./dist",
"baseUrl": "./",
"incremental": true
},
"include": ["src"],
"exclude": ["node_modules", "dist", "public"]
}

关于node.js - NestJS 阻止服务器在开发中重新加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61384822/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com