Nest-cli: Default watch perimeter is too violent ; we should be able to edit an exclusion list

Created on 8 Apr 2020  Â·  8Comments  Â·  Source: nestjs/nest-cli

I'm submitting a...


[ ] Regression 
[ ] Bug report
[X] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior


It seems to me nest-cli default start:debug task watch the whole project including node_modules. That's not reasonable cause it will trigger a restart of the server anytime a runtime file is edited which can cause undesired collateral damages. Editing the "exclude" property in tsconfig.json does not work.

Expected behavior


There should be a way to exclude some folders from watch perimeter.

Minimal reproduction of the problem with instructions

What is the motivation / use case for changing the behavior?


Current behaviour is too violent.

Environment

[System Information]
OS Version     : macOS Mojave
NodeJS Version : v12.13.0
NPM Version    : 6.12.0 

[Nest CLI]
Nest CLI Version : 7.0.0 

[Nest Platform Information]
platform-express version : 7.0.7
serve-static version     : 2.1.0
common version           : 7.0.7
config version           : 0.4.0
core version             : 7.0.7
needs clarification

Most helpful comment

Just for people who might see this:

  • excluding folders in tsconfig files does not work BUT…
  • refining the include list do:

    • "include": ["src/**/*"], in tsconfig.build.json

Maybe that should be the default @kamilmysliwiec?

All 8 comments

I have never faced this issue tbh.
Please provide a minimum reproduction repository.

Just create a new project with nest new baz.
Create a folder inside for instance db.
Start your server in watch mode: yarn start:debug.
While server is on, go into your db folder via another terminal and create a file: touch foo.
Server detect changes and restart.
baz.zip

To provide context, in my case, this is an issue cause my server generate reports and thus I obviously don't want to restart while in the middle of generating it.

Did the test with @nestjs/cli 7.0.0 and 7.1.2: same behaviour.

But this isn't caused by Nest CLI. If you replace start:debug script with a simple tsc --watch and node --inspect-brk in parallel, you will get the same outcome.

Yes that's possible, I don't know how it works under the hood. But how nest developers proceed in that case? I'm probably not the only one with that kind of issue. I will have the same issue with a file database that this project is using. What would be the recommended approach then?

Consider asking on our Discord channel (support) for such questions :) Maybe someone found a nice solution for this.

Let me close this issue since we are using GitHub to track bugs, feature requests, and potential improvements.

Just for people who might see this:

  • excluding folders in tsconfig files does not work BUT…
  • refining the include list do:

    • "include": ["src/**/*"], in tsconfig.build.json

Maybe that should be the default @kamilmysliwiec?

Was this page helpful?
0 / 5 - 0 ratings