rykener / django-manifest-loader

Simplifies webpack configuration with Django
https://django-manifest-loader.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
104 stars 12 forks source link

Hot reloading or automatic browser reload? #44

Open tobyl opened 3 years ago

tobyl commented 3 years ago

Thanks so much for this, I was using django-webpack-loader but this is much simpler!

Do you have a recommendation for how to achieve automatic browser reloading when the assets are updated? I know this can be achieved using browsersync or livereload, but I'm hoping to not have to run a third process (on top of django server and webpack watch) during development.

Thanks again!

rykener commented 3 years ago

Hi @tobyl, so glad you're enjoying this. If you'd like, I'd love to have the project shared with others who would use it. I feel it's the best solution out there at the moment for this problem.

There's not a great option for hot reloading that I'm aware of. What I do in one project is have a javascript interval running on the front end and querying an endpoint that returns the hashed filename. I then check this against my application state to determine if the filename has changed, and then if it has I execute a refresh through the javascript.

This is... a heavy-handed approach, but it does technically work.

thisisnotmyuserid commented 3 years ago

I was researching this a while back. Looks like anything with this kind of functionality has not seen any updates in a long time...

https://github.com/fabiogibson/django-livesync

https://github.com/tjwalch/django-livereload-server

And of course, no idea how these would play with manifest-loader.

knokit commented 3 years ago

I'm using Webpack's devServer to serve my bundles with a proxy setup to redirect any other request to the Django server.

I think this is where I got the idea from, take a look: https://stackoverflow.com/a/58040422/1309785