You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a feature request that would be super helpful for development workflows: could we add an environment variable (something like DENO_HMR=true) whenever Hot Module Replacement is active?
The problem I'm facing
I'm building a web server (Yelix) with Deno that does some initialization work before handling requests. During development with HMR enabled, I'd like to skip this initialization step on hot reloads since the server is still running and doesn't need to redo everything.
The challenge is that I can't detect if HMR is active at the beginning of my program. The "hmr" event fires after the initial load, so I can't make decisions based on it early enough.
My suggestion
Set an environment variable like DENO_HMR=true when the HMR runtime starts up. This could be done in the HmrRunner::run method or its constructor.
This would let applications detect HMR from the very start and optimize their behavior accordingly. It seems like a small change that could help developers create better development experiences.
I think this would be especially useful for framework authors who want to optimize startup behavior during development cycles.
I actually thought of analyzing the codebase and opening a pr, but unfortunately I am not very familiar with the rust environment that I need to test the code I wrote, and there will be written tests of this, so I opened it as a feature request.
Hi Deno team!
I have a feature request that would be super helpful for development workflows: could we add an environment variable (something like DENO_HMR=true) whenever Hot Module Replacement is active?
The problem I'm facing
I'm building a web server (Yelix) with Deno that does some initialization work before handling requests. During development with HMR enabled, I'd like to skip this initialization step on hot reloads since the server is still running and doesn't need to redo everything.
The challenge is that I can't detect if HMR is active at the beginning of my program. The "hmr" event fires after the initial load, so I can't make decisions based on it early enough.
My suggestion
Set an environment variable like DENO_HMR=true when the HMR runtime starts up. This could be done in the HmrRunner::run method or its constructor.
This would let applications detect HMR from the very start and optimize their behavior accordingly. It seems like a small change that could help developers create better development experiences.
I think this would be especially useful for framework authors who want to optimize startup behavior during development cycles.
The relevant code would be in cli/tools/run/hmr.rs.
The text was updated successfully, but these errors were encountered: