IHP 1.3 is out now!

← Back to Feature Requests

Auto reload browser on JS file change

As a low-barrier way to use front-end frameworks and languages, I wish to suggest that javascript files inside the static folder should lead to browser refresh.

This gives us instant re-evaluatation based on file changes like we already have with the HSX templating.

HMR (hot module replacement) is convenient and a common component of bundlers, letting you re-evaluate JS code changes and preserve the state of the frontend-application. But the implementations are hacky, bug-prone and depends on the node.js ecosystem.

Hot reloading, just simply forcing the browser to reload, is techically simpler and will work for mostly any bundle-less JS frontend-tool. It could also be useful for the small amount of scripting in a JS-minimal IHP application.

Being able to omit nodejs will lead to faster build and deploy times. Packages in the node.js eco system are also extremely prone to breaking changes and a recurring source of frustration in the JS ecosystem.

Bundlers are also very rapidly evolving tools that could lead to a higher demand for maintaining the IHP docs.

A small detail of convenience, but a small incremental step towards a better developer experience :)

If a developer chooses to use parcel, webpack or some other bundler with HMR anyway, there should maybe be a flag like noJSReload so that the bundler can take responsibility of re-evaluation.

Comment +