Closed martynchamberlin closed 6 years ago
HMR works with webpack Although sourcemaps get screwed for me with HMR And there are some edge cases. But for general development workflow - it's good.
Please for questions use https://discourse.aurelia.io/
can be closed
Seems like we might need a bit of documentation here: http://aurelia.io/docs/cli/webpack @JeroenVinke Can you add a small section or few sentences on enabling HMR with the Webpack build?
Will do
It would be good to have a documentation for those who do not use aurelia cli as well.
Thanks guys. A followup question on this. When I enable HMR on an out-of-the-box CLI Aurelia project, making a change to e.g. the app.html
file causes the page at localhost:8080 to do a hard page refresh automatically. In React and Vue etc the view changes on the fly implicitly without a page refresh. Does Aurelia HMR support this? If so, what changes would we have to make to the Webpack configuration provided by Aurelia CLI in order to get this?
@martynchamberlin there was a separate issue about app.html changes leading to full refresh.. it was not figured out.. seemed like "oh.. well" can live with it.
Well, I don't think the issue just lives with the root app.html
component. In the sample CLI project, I created a new component and included it in app.html
via a require
statement like so:
<template>
<require from="./example-thing"></require>
<h1>${message}</h1>
<example-thing></example-thing>
</template>
If I make changes to example-thing.html
, the page still does a hard refresh in order to get the latest changes into the browser.
The whole premise of Hot Module Reloading is that the browser doesn't have to a hard page refresh when you save a file. I have yet to see an example of an Aurelia that has true HMR in it. Does Aurelia have this yet?
Currently we use Gulp in our development environment. We are looking to move to Webpack and set up HMR, but it's really not clear from the README what all is involved in setting this up. The README links to a page that doesn't exist (http://aurelia.io/hub.html) and when I go there and do a search for "HMR" or "hot module reload" or any such permutation, I come up dry.
An example of a REAMDE for HMR that's got good documentation can be found at https://github.com/gaearon/react-hot-loader. Code examples etc. Can we please have this? :) Thanks!