leebenson / reactql

Universal React+GraphQL starter kit: React 16, Apollo 2, MobX, Emotion, Webpack 4, GraphQL Code Generator, React Router 4, PostCSS, SSR
https://reactql.org
MIT License
1.82k stars 173 forks source link

Hot reload of Koa server (HMR) #147

Open ZimboQC opened 5 years ago

ZimboQC commented 5 years ago

Hot reload works perfectly for components, lib & entry folder, but I'm unable to make it works in app.js (I've put an apollo server at that level)

How to get hot-reload at all levels?

Thanks!

leebenson commented 5 years ago

This is on my radar, but I'm punting on it for the time being because it's a sizeable refactor.

The current Koa Webpack hot reloading flow requires that entry/server.tsx exports a default function that is in the shape of a Koa middleware function. That would need ripping out, and HMR on the server would be replaced with a new function that takes the full koa instance, and re-builds in Webpack whenever there's a change.

I plan to tackle this soon, just don't have the cycles for it yet. In the meantime, if anyone wants to submit a PR, this would be a great one to focus on!

beepsoft commented 5 years ago

+1 for Koa hot reload!