Replies: 2 comments 1 reply
-
@sanex3339 @ahangarha @Judahmeek, this is great. We need to update the docs! |
Beta Was this translation helpful? Give feedback.
1 reply
-
See #1253 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi. I'm not sure, maybe the README is outdated, but it says that this gem does not support HMR when SSR is enabled.
I was able to make it work both for server and client bundles.
What i did:
process.env.WEBPACK_SERVE && 'react-refresh/babel'
plugin to thebabel.config.js
filebin/webpack-dev-server
file to build bundles + run dev serverwebpack
config we have the following option for the dev server:The important thing is to use
writeToDisk
and in my case i only saveserver_rendering.js
file to the disk, so the server is able to always read the updated file.ReactRefreshWebpackPlugin
to thewebpack
config as welloutput.publicPath
value for dev environment we usehttp://localhost:${DEV_SERVER_PORT}/some_project/assets
, so all client assets are served by the dev server as wellshakepaker
config in the babel or webpack configs at allwebpacker.yml
for dev environment we have:And this is all, the HMR works, the server renders updated HTML every time when react code is changed.
Beta Was this translation helpful? Give feedback.
All reactions