Search code examples
nestjs

Is there a way to configure NestJs --watch mode to not clear the terminal?


When running a new NestJs application in --watch mode I had noticed that it clears my terminal right before logging in stdout "Starting compilation in watch mode...".

I know it is using some form of escape sequence, either \ec or \0033\0143 (essentially ESC+c) but I need so badly for that not to happen. I need the terminal not to clear.

Is there a way in any form of the NestJs configuration where I can disable this?

I'm running a concurrent process of multiple stdout and its clearing all of my processes for its own logs. within the concurrent process I've tried transforming the output to remove the escape characters. First, it feels a bit excessive to go down this approach as I should be able to stop NestJs from doing it in the first place.


Solution

  • --preserveWatchOutput

    Also you can add it to the tsconfig.json

    {
      "compilerOptions": {
        "preserveWatchOutput": true
      }
    }
    

    I dug so deep on this problem only to discover my solution was merged in v.10.4.5