-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Webpack HMR does not refresh on HTML changes. #232
Comments
open for pull requests |
Is there any further information about this issue? It'd really be a convenience if pages update automatically when template changes. 😏 |
I guess it's not possible - if so feel free to open a pull request |
@jantimon Is this something that should be in the webpack-dev-server repo? Or is this a html-webpack-plugin related limitation? Just tracking. |
So far, I've approached this by publishing a custom event on webpack-hot-middleware, and consuming that event in client JavaScript, as in HenrikJoreteg/hjs-webpack#247 This approach isn't my idea, I originally saw it in this comment. As far as I can tell, it's not possible to live reload HTML without something of a hack, but it seems like a relatively benign hack that could possibly lead to a proper approach. It seems like webpack-dev-server or webpack-hot-middleware are more appropriate to be concerned with this functionality than html-webpack-plugin, but I don't have a good sense of what API they would expose to trigger reloads in the browser. |
I suppose that this issue is somewhat historical and it never worked? If so, it is very interesting how is that possible considering years of existence of webpack ecosystem. Probably it was never in a spotlight due to the unpopularity of such use case. I saw repeated issues about this, also in Currently, I am trying to solve this, and I guess I can not use workaround with custom file watch, because my HTML is not static, it gets built by webpack, so I can't really "watch" HTML on a file system, and instead need a "native" ability to recognize and handle this... |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I've been seeing an issue with Webpack, both 1.x and the 2.0 beta, wherein the hot module reloader doesn't refresh after to HTML templates. Webpack sees the change and logs the update, but the
webpack/hot/dev-server
module doesn't trigger a refresh.I did a little amateur sleuthing, and it looks like using a subcompiler prevents the Webpack hash from being updated:
When the hot reloader compares the new compilation hash against the old one (https://github.com/webpack/webpack/blob/master/hot/dev-server.js#L9), it just sees that the global compilation hasn't been updated and takes no action.
For the moment I'm making do with a slightly patched version of the HMR module that always returns
false
fromcheck()
. Sadly I don't have a sufficient understanding of Webpack's deep magic to dive in and fix this, but it seemed like something you might want to keep in your backlog.Thanks for all your hard work on this plugin!
The text was updated successfully, but these errors were encountered: