NestJS (7.5.1) not watching assets in watch mode

Viewed 2492

For some reason, the nest start --watch is not watching any non-typescript assets. Even though I've followed exactly what this doc said: https://docs.nestjs.com/cli/monorepo#assets I can't seem to figure this out. I've tried in standard mode and mono-repo mode to no success. I started a new project just to demonstrate what I'm seeing.

Nest --version: 7.5.1

When running command: npm run start:dev I would expect to see that every time I update my html files, then I should see the "incremental file change detected" message and the app reloads but nothing is happening after the initial app load. On initial app load, the files do get copied to the dist folder so thats fine but I would expect that as I'm developing and updating these files, the app should also be reloading but it only seems to work for typescript files. Am I misunderstanding what this should be doing?

Here's the nest-cli.json:

{
  "collection": "@nestjs/schematics",
  "sourceRoot": "src",
  "compilerOptions":{
    "assets": ["**/*.html"],
    "watchAssets": true
  }
}

Any ideas??

2 Answers

Your assets configuration seems to be wrong, try passing an object to the array as they do in the documentation:

"assets": [
  { "include": "**/*.html", "watchAssets": true }
]

Assets configuration works as described in documentation. VS Code wasn’t registering file changes so I proved it by manually editing a file outside or the IDE and it works. Closing question

Related