Can I get a simple, up-to-date and working example for hot-reloading?
See original GitHub issue- Node Version: v11.10.0
- NPM Version: 6.7.0
- koa Version: 2.7.0
- koa-wepback Version: 5.2.1
I think the README.md should have a clear example on how to make a simple app work with hot-reloading. Iāve been trying to make this repo work for a couple days now and I canāt get any changes inside my serverās code to refresh my page.
router.get('/', (ctx, next) => {
ctx.body = "Doesn't change unless a force a refresh manually";
});
Iāve looked at multiple examples in this GitHub issues and theyāre all old and out-dated. Now the middleware uses Async/Await and itās really unclear where to use it (before or after initialising route). Itās also unclear what should exactly be in my webpack.config for hot-reloading and if I still have the need to do this in my index file.
if (module.hot) {
{...}
}
This is not a request for support, itās an actual issue that thereās so little practical documentation on how to make it work correctly, a simple example would go a long way.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:11 (4 by maintainers)
Apologies š Thatās not the point Iām making. I adore Koa due to itās core support for
async/await
, however this support is in the middleware functions themselves, i.e. once you enter the context scope withapp.use(...)
. (AFAIK) Node itself doesnāt particularly support a randomawait
in the middle of synchronous code - it has to be inside anasync
function.Quoting your README directly:
Should it not be:
In order to support this
await
keyword?⦠And to bring this issue full-circle, a working example file included in this repo would have cleared this up!
Why do you hate providing examples? Itās the easiest way for someone to learn/use your project.