Skip to content

cli: make run and watch modes friends

This is without tests until some conversation is had because it is a bit wonky. This makes --watch work with --run so you can do things like node --watch-path src --run start with the following package.json:

{
  "devDependencies": {
    "esbuild": "^0.21.5"
  },
  "scripts": {
    "start": "esbuild --platform=node --bundle src/main.mts --format=cjs --outfile=dist/main.cjs && node dist/main.cjs"
  }
}

Demo

https://github.com/nodejs/node/assets/234659/bd5c4fb0-bbbf-48ab-9e6c-b2679f08b3fa

Merge request reports

Loading