react-refresh-webpack-plugin
react-refresh-webpack-plugin copied to clipboard
Plugin seems to not like working in SSR
While the page refreshes automatically as expected, if I am in need of refreshing the page (or opening a new page even) the page will error out complaining of even the smallest change (just text, for example).
Warning: Text content did not match. Server: "Hello, dude! Click count: " Client: "Hello, fella! Click count: "
at h1
at div
at HelloWorld (http://localhost:3000/dist/bundle.js:3996:66)
at Router (http://localhost:3000/dist/bundle.js:42092:15)
at BrowserRouter (http://localhost:3000/dist/bundle.js:40322:5)
at App
node_modules/react-dom/cjs/react-dom.development.js:86
Warning: An error occurred during hydration. The server HTML was replaced with client content in <div>.
Is this plugin incompatible with SSR methodologies?
any fix? same issue
Everything works. I added the plugin to the Webpack for both the client and the server config to make it work.
@Kallenju can you give a simple repo example?
@Kallenju can you give a simple repo example?
Of course. But, I want to warn you that I am a noob in React.
https://github.com/Kallenju/template-for-react-ts-ssr-hmr
For start:
npm install
npm run dev
React component in './src/shared/Header.tsx'
thanks! It seems to work well. I think my mistake was caused by I do not restart nodejs server.
I have a template repo as well with SSR: https://github.com/adbutterfield/fast-refresh-express