Skip to content

Commit

Permalink
breaking(rsc): Removing live-reload RSC dev server approach (#11648)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobbe authored Oct 3, 2024
1 parent 20c670e commit 4a7b887
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 155 deletions.
2 changes: 0 additions & 2 deletions packages/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
},
"bin": {
"rw-dev-fe": "./dist/devFeServer.js",
"rw-dev-rsc": "./dist/devRscServer.js",
"rw-serve-fe": "./dist/runFeServer.js",
"rw-vite-build": "./bins/rw-vite-build.mjs",
"rw-vite-dev": "./bins/rw-vite-dev.mjs",
Expand Down Expand Up @@ -74,7 +73,6 @@
"acorn-loose": "8.4.0",
"buffer": "6.0.3",
"busboy": "^1.6.0",
"chokidar": "3.6.0",
"cookie": "0.6.0",
"core-js": "3.38.1",
"dotenv-defaults": "5.0.2",
Expand Down
131 changes: 0 additions & 131 deletions packages/vite/src/devRscServer.ts

This file was deleted.

5 changes: 0 additions & 5 deletions packages/vite/src/runFeServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
// fe-server. And it's already created, but this hasn't been moved over yet.

import path from 'node:path'
import process from 'node:process'
import url from 'node:url'

import { createServerAdapter } from '@whatwg-node/server'
Expand Down Expand Up @@ -202,10 +201,6 @@ export async function runFeServer() {
console.log(
`Started production FE server on http://localhost:${rwConfig.web.port}`,
)

if (typeof process.send !== 'undefined') {
process.send('server ready')
}
}

function createWebSocketServer() {
Expand Down
16 changes: 1 addition & 15 deletions packages/vite/src/streaming/streamHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,6 @@ globalThis.__webpack_require__ ||= (id) => {
};
`

const rscLiveReload = `\
// NOTE: This code is used during development to enable "live-reload."
window.addEventListener('load', () => {
const sse = new EventSource('http://localhost:8913');
sse.addEventListener('reload', () => {
window.location.reload();
});
window.addEventListener('beforeunload', () => {
sse.close();
});
// TODO (RSC): Handle disconnect / error states.
});
`

export async function reactRenderToStreamResponse(
mwRes: MiddlewareResponse,
renderOptions: RenderToStreamArgs,
Expand Down Expand Up @@ -193,7 +179,7 @@ export async function reactRenderToStreamResponse(
bootstrapScriptContent:
// Only insert assetMap if client side JS will be loaded
jsBundles.length > 0
? `window.__REDWOOD__ASSET_MAP = ${assetMap}; ${rscWebpackShims}; ${isProd ? '' : rscLiveReload}`
? `window.__REDWOOD__ASSET_MAP = ${assetMap}; ${rscWebpackShims}`
: undefined,
bootstrapModules: jsBundles,
}
Expand Down
2 changes: 0 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8932,7 +8932,6 @@ __metadata:
acorn-loose: "npm:8.4.0"
buffer: "npm:6.0.3"
busboy: "npm:^1.6.0"
chokidar: "npm:3.6.0"
concurrently: "npm:8.2.2"
cookie: "npm:0.6.0"
core-js: "npm:3.38.1"
Expand Down Expand Up @@ -8960,7 +8959,6 @@ __metadata:
yargs-parser: "npm:21.1.1"
bin:
rw-dev-fe: ./dist/devFeServer.js
rw-dev-rsc: ./dist/devRscServer.js
rw-serve-fe: ./dist/runFeServer.js
rw-vite-build: ./bins/rw-vite-build.mjs
rw-vite-dev: ./bins/rw-vite-dev.mjs
Expand Down

0 comments on commit 4a7b887

Please sign in to comment.