bun icon indicating copy to clipboard operation
bun copied to clipboard

Add support for `--watch`

Open Electroid opened this issue 3 years ago • 2 comments

What is the problem this feature will solve?

Node.js added support for node --watch in v18. --watch is common among other developer tools, so we should support it as well.

This is different than --hot, because --watch reloads the process, while --hot does not.

What is the feature you are proposing to solve the problem?

See https://github.com/oven-sh/bun/issues/1356#issuecomment-1284594045

What alternatives have you considered?

No response

Electroid avatar Oct 19 '22 20:10 Electroid

It's not exactly the same thing

  • --hot means "reload the code without restarting the process"
  • --watch means "restart the process on change"

This sounds like a distinction without a difference but it impacts how people expect it to work.

I think Bun should potentially support both hot reloading and live reload, especially for tests. HMR for tests don't make much sense - you want a clean state before each run.

Jarred-Sumner avatar Oct 19 '22 21:10 Jarred-Sumner

I think another option is to say "Did you mean --hot"? When they try "--reload" and it doesn't do anything

Jarred-Sumner avatar Oct 19 '22 21:10 Jarred-Sumner

This is implemented in v0.5.9 isn't it?

vjpr avatar May 17 '23 14:05 vjpr

Yes, this has been implemented.

Electroid avatar May 17 '23 16:05 Electroid

Trying either bun --hot run dev.tsx, bun --watch run dev.tsx does not do anything when modifying App.tsx and reloading (Command + R) in bun v.0.7.3.

g-wozniak avatar Aug 23 '23 15:08 g-wozniak