oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
73.31k stars 2.69k forks source link

Allow --hot to reload when new files/dirs are created #1922

Open Kapsonfire-DE opened 1 year ago

Kapsonfire-DE commented 1 year ago

What is the problem this feature would solve?

I need to use my own (file system) router, who scans during 'bake' phase and create routes/loaders/websocket handlers and so on so anytime a 'dir/file' changes I need bun to reload and even scan for the files/dirs created

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

--hot scans for all changes of root dir (recursive) in project (where package.json is located) and triggers reload when anything changed

new dir, new file, deleted and so on.

with

--hot-ignore="./node_modules" (default)

we can define paths which should not trigger a reload on change

What alternatives have you considered?

Implementing dir watcher my self in runtime

chrisAXZA commented 1 year ago

Basically an integrated nodemon feature ?

Kapsonfire-DE commented 1 year ago

bun already has --hot, but it only respects files which got imported already

OmgImAlexis commented 1 year ago

Would also love to see the same thing but with the --watch flag