-
-
Notifications
You must be signed in to change notification settings - Fork 52
Description
- Node Version: v6.10.0
- NPM Version: 3.10.10
- koa Version: 2.0.1
- koa-wepback Version: 0.3.1
// webpack.config.js
export default {
entry: {
head: [
'webpack-hot-middleware/client',
'babel-polyfill',
`${APP}/entry.js`,
`${STYLES}/main.scss`,
],
},Server integration:
https://github.com/tomatau/breko-hub/blob/koa2/src/helpers/hotReload.js#L24-L38
Actual Behavior
After making any file change, my server is logging
COMPILER DONE
webpack built a6f0726c3057b262a440 in 330ms
publish everyClient built
But sometimes the client logs nothing. However, if I repeatedly save the file (without changes), eventually my client will log
[HMR] bundle rebuilding
client.js?3ac5:207 [HMR] bundle rebuilt in 883ms
process-update.js?e13e:27 [HMR] Checking for updates on the server...
How can we reproduce the behavior?
Clone this branch on this boilerplate repository: https://github.com/tomatau/breko-hub/tree/koa2
Ensure you have a .env file with NODE_ENV=development. Enable the debugger (sensible defaults in example.env). Run npm start and make multiple file changes to any react component.
hot-reload Webpack compile started... +39s
hot-reload Webpack compiling... +0ms
hot-reload Clearing /app/ module cache from server +648ms
hot-reload hot reloading server change /Users/tomatao/Projects/tomatao/js/breko-hub/src/server/webpack-assets.json +235ms
hot-reload Webpack compile started... +2s
hot-reload Webpack compiling... +1ms
hot-reload Clearing /app/ module cache from server +285ms
hot-reload hot reloading server change /Users/tomatao/Projects/tomatao/js/breko-hub/src/server/webpack-assets.json +133ms
hot-reload Webpack compile started... +2s
hot-reload Webpack compiling... +1ms
hot-reload Clearing /app/ module cache from server +344ms
<-- GET /1691eb07362da1beccb5.hot-update.json
--> GET /1691eb07362da1beccb5.hot-update.json 200 1ms 43b
<-- GET /0.1691eb07362da1beccb5.hot-update.js
--> GET /0.1691eb07362da1beccb5.hot-update.js 200 2ms 8.03kb
hot-reload hot reloading server change /Users/tomatao/Projects/tomatao/js/breko-hub/src/server/webpack-assets.json +126ms
You can see a "Webpack compile started..." for each file save, but only eventually does the request come through for the hot-update chunks.
Notes
Thanks for making this library. I originally tried koa-webpack-middleware but it was breaking mime types as the hot middleware set octetstream on every response.
My boilerplate (linked) was working fine in every way for hot reloading (even server side live updates and hot updates of css-modules). I have made the minimal changes to migrate to koa2 and debugging this issue has left me stumped. I have thrown logs all over webpack-hot-middlewares client middleware and server middleware and can see the server sending messages but the client only receiving a subset of them. Eventually if I CMD+S on my file enough times after making a change the client will update.
This may be a more appropriate issue for webpack-hot-middleware but that repository seems less responsive to issues.