So I've been trying for the last few days completely in vain to get hot module reloading working in my Typescript/React/Koa/Mongo based monorepo; I feel like I've been banging my head against a brick wall. The documentation for HMR is pitiful (almost everything on the internet only goes part of the way of explaining how to do something). I've done a lot of googling and read lots of different ... similar versions of my problem, but nobody seems to have a useful solution.
I've put together a minimal repo version of the problem: https://github.com/benwainwright/hmr-issue-minimal-repo, that is roughly how my project is set up:
packages/oneis a Yarn workspace containing the backend codepackages/twois a Yarn workspace containing the React components/frontend code
If I build this and run it, I can sometimes get it to notice that I'm trying to do a hot reload in the client, fail, and then do a complete page reload. When that happens, the following error appears on the console
「hot」 Error: Aborted because ../two/renderApp.tsx is not acceptedUpdate propagation:
../two/renderApp.tsx -> ../two/index.tsx -> ./src/frontend-entry-point.tsx -> 1 at
hotApplyInternal (http://localhost/assets/app.js:508:30) at Object.hotApply [as apply]
(http://localhost/assets/app.js:362:19) at eval (webpack-internal:///./node_modules/webpack-hot-
client/client/hot.js:121:23)
I've tried all sorts of different combinations of the various packages and I've also swapped the code that does the hotswap (https://github.com/benwainwright/hmr-issue-minimal-repo/blob/edcd8ad8c4fb9686abce12237d51a5b6f37dd636/packages/two/renderApp.tsx#L13-L16) with react-hot-loader. Nothing works. If anyone has any idea how to get this working, I'll be eternally greatful!