feat: websocket HMR
This commit is contained in:
parent
d86e696cd2
commit
767cd4d564
|
@ -11,12 +11,17 @@ import { RemixServer } from "@remix-run/react";
|
||||||
import { isbot } from "isbot";
|
import { isbot } from "isbot";
|
||||||
import { renderToPipeableStream } from "react-dom/server";
|
import { renderToPipeableStream } from "react-dom/server";
|
||||||
|
|
||||||
import websocketServer from './websocket';
|
|
||||||
|
|
||||||
const ABORT_DELAY = 5_000;
|
const ABORT_DELAY = 5_000;
|
||||||
|
|
||||||
export async function websocket(server) {
|
export async function websocket(server, viteDevServer) {
|
||||||
await websocketServer(server);
|
if (viteDevServer) {
|
||||||
|
const {createViteRuntime} = await import('vite');
|
||||||
|
const runtime = await createViteRuntime(viteDevServer);
|
||||||
|
(await runtime.executeEntrypoint('/app/websocket.js')).default(server);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
(await import('./websocket.js')).default(server);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function handleRequest(
|
export default function handleRequest(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user