diff --git a/package.json b/package.json index ea02b4f..8912d95 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "react-router-devtools", "description": "Devtools for React Router - debug, trace, find hydration errors, catch bugs and inspect server/client data with react-router-devtools", "author": "Alem Tuzlak", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "keywords": [ "react-router", @@ -106,7 +106,7 @@ "react": ">=17", "react-dom": ">=17", "react-router": ">=7.0.0", - "vite": ">=5.0.0" + "vite": ">=5.0.0 || >=6.0.0" }, "devDependencies": { "@biomejs/biome": "1.9.4", diff --git a/src/vite/plugin.tsx b/src/vite/plugin.tsx index a8987c8..3c8a9ff 100644 --- a/src/vite/plugin.tsx +++ b/src/vite/plugin.tsx @@ -141,8 +141,9 @@ export const reactRouterDevTools: (args?: ReactRouterViteConfig) => Plugin[] = ( server.httpServer?.on("listening", () => { process.rdt_port = server.config.server.port ?? 5173 }) - // @ts-ignore - Fix this - const channel = server.hot.channels.find((channel) => channel.name === "ws") + //@ts-ignore - vite 5/6 compat + const channel = server.hot.channels.find((channel) => channel.name === "ws") ?? server.environments?.client.hot + server.middlewares.use((req, res, next) => handleDevToolsViteRequest(req, res, next, (parsedData) => { const { type, data, routine } = parsedData @@ -150,9 +151,7 @@ export const reactRouterDevTools: (args?: ReactRouterViteConfig) => Plugin[] = ( unusedEvents.set(parsedData.id + parsedData.startTime, parsedData) for (const client of server.hot.channels) { // @ts-ignore - Fix this - if (client.name === "ws") { - client.send("request-event", JSON.stringify(parsedData)) - } + client.send("request-event", JSON.stringify(parsedData)) } return @@ -176,9 +175,7 @@ export const reactRouterDevTools: (args?: ReactRouterViteConfig) => Plugin[] = ( } for (const client of server.hot.channels) { // @ts-ignore - Fix this - if (client.name === "ws") { - client.send("route-info", JSON.stringify({ type, data })) - } + client.send("route-info", JSON.stringify({ type, data })) } }) )