NiK
NiK

Reputation: 1857

Prevent restart of NestJS Server when making changes in certain directories

I am using the default nest start --watch command to run the application in watch mode.

The server restarts upon the change of any source file, which is as expected.

However, I need to ignore some directories or files from restarting the server when a change occurs.

Is there a way to achieve this in NestJS?

Upvotes: 6

Views: 5302

Answers (4)

Darshan Asolkar
Darshan Asolkar

Reputation: 1

You should update following package:

  • typescript

Upvotes: 0

Yamlak Kassahun
Yamlak Kassahun

Reputation: 23

I was able to fix this by editing tsconfig.build.json file and add the folder to the exclude array. "exclude": [..., "your-folder"]

Upvotes: 0

NiK
NiK

Reputation: 1857

I was able to find a workaround. That is updated nodemon.json file to include the directories that I want to ignore from restart. Then to start the app I am just running nodemon command.

{
    "watch": ["src"],
    "ext": "ts",  
    "ignore": ["public"],
    "exec": "ts-node ./src/main"
  }

Hope this helps

Upvotes: 5

WRAD
WRAD

Reputation: 31

You should edit these files:

  • tsconfig.json
  • tsconfig.build.json

Add the folder/s that you want to ignore in the "exclude" array:

"exclude": [..., "your-folder"]

Upvotes: -3

Related Questions