Skip to content

Commit 743eaed

Browse files
committed
chore: cleanup
1 parent ea048d2 commit 743eaed

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

packages/plugin-rsc/examples/browser-mode/vite.config.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default defineConfig({
2121
}),
2222
vitePluginDefineEncryptionKey(),
2323
{
24-
name: 'rsc:run-in-browser',
24+
name: 'rsc:browser-mode',
2525
configureServer(server) {
2626
server.middlewares.use(async (req, res, next) => {
2727
const url = new URL(req.url ?? '/', 'https://any.local')
@@ -37,10 +37,16 @@ export default defineConfig({
3737
next()
3838
})
3939
},
40-
// hotUpdate(ctx) {
41-
// // TODO find out how to do HMR
42-
// ctx.server.ws.send({ type: "full-reload", path: ctx.file });
43-
// },
40+
hotUpdate(ctx) {
41+
if (this.environment.name === 'react_client') {
42+
if (ctx.modules.length > 0) {
43+
ctx.server.environments.client.hot.send({
44+
type: 'full-reload',
45+
path: ctx.file,
46+
})
47+
}
48+
}
49+
},
4450
config() {
4551
return {
4652
environments: {

0 commit comments

Comments
 (0)