Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Instant hot reloading without even recompiling/refreshing the page? Sorry, try again.

Flame charts in Visual Studio 2003? Sorry, try again.



Most backend frameworks can just route new requests to the updated code - so a refresh is all you need (though there are tools that simply make that refresh automatic, which is pretty much how js frameworks work as well. Intellij can also make the whole recompile-replace code function happen on window defocus, so by the time you switch to your browser, it is already refreshed. And nowadays the compile of something like Java can well be faster than whatever that npm monstrosity does)


Javascript hot reloading requires a "recompile", you just don't notice it. Import a plain js file without any node tooling and see what you get for free.


It's not a "recompile". JS doesn't get compiled, it may get transpiled or minified. Node.js is only used for sending data over a local websocket from the file system to the browser. You can totally also achieve this effect on a local offline webpage that wasn't even being served if you added an input on the page (ie the React docs: https://react.dev/learn).


Yes. But the difference in this context is nitpicking. The browser needs to know what file was changed, and what to do with those changes right? And preserve state. That doesn't magically happen it's the tooling that supports it.

I could probably set up a simple environment to watch for changes, run make, reload the binary at $current_state in gdb with a one-liner. But it doesn't really fit the work flow, and GDB already gets all changes after I run make.


> Import a plain js file without any node tooling and see what you get for free.

I get F5 to refresh the page when source code changes. All the other tooling remains the same: https://developer.chrome.com/docs/devtools/

I mean, Chrome even has an animations debugger


> I get F5 to refresh the page when source code changes.

Really? That's surprising but so overkill. How does it know what files to poll and which not to, I assume file:// and localhost but more specific? Does it do it for a webpack/vite app which has its own hot reloading setup?


What do you mean?

F5 refreshes the browser page. This has been the way to develop pages since the first browsers.

And the original question was "Import a plain js file without any node tooling and see what you get for free." You don't get hot reloading but you get all I wrote in my original comment and much more for free.


Yes, I know I was just surprised it even checks for changes without being prompted, but I guess that's where all the resources go. The point I was trying to make was a response to your claim that hot reloading magically happens without "compiling", it doesn't (I know I know, it's transpiling in js).

It usually goes something like this: some tool watches the file system for changes > trigger build > another tool in the chain injects changes into session > picked up by client to reflect changes, if done well without resetting state.

These are many tools in a toolchain working well together. This DOES exist in other languages, incremental builds exists. You can save and restore a binary at a certain state, and it's less hassle than it is in js.

One thing the systems development world has that I haven't seen in browser tools is radare/ghidra to follow code paths but it probably exists as a browser extension. The web is just reinventing and repackaging tools that have existed for decades.

> you get all I wrote in my original comment and much more for free

Yes, but `apt install gdb` is just as "free" as `apt install chrome` no? Everything you mentioned exists in systems development, you just haven't used it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: