feat: upgrade react-router + hono-server

This commit is contained in:
Aarnav Tale
2025-08-18 16:04:30 -04:00
parent 616b63bb71
commit 17712cbb1c
4 changed files with 1179 additions and 1096 deletions
+10 -13
View File
@@ -26,11 +26,11 @@
"@libsql/client": "^0.15.9",
"@primer/octicons-react": "^19.15.2",
"@react-aria/toast": "3.0.3",
"@react-router/node": "^7.6.1",
"@react-router/node": "^7.8.1",
"@react-stately/toast": "3.1.0",
"@shopify/lang-jsonc": "^1.0.1",
"@types/react": "^19.1.6",
"@types/react-dom": "^19.1.5",
"@types/react": "^19.1.10",
"@types/react-dom": "^19.1.7",
"@uiw/codemirror-theme-github": "^4.23.12",
"@uiw/codemirror-theme-xcode": "^4.23.12",
"@uiw/react-codemirror": "^4.23.12",
@@ -48,16 +48,16 @@
"lucide-react": "^0.511.0",
"mime": "^4.0.7",
"openid-client": "^6.5.0",
"react": "19.1.0",
"react": "19.1.1",
"react-aria": "^3.40.0",
"react-codemirror-merge": "^4.23.12",
"react-dom": "19.1.0",
"react-dom": "19.1.1",
"react-error-boundary": "^6.0.0",
"react-icons": "^5.5.0",
"react-router": "^7.6.1",
"react-router-hono-server": "^2.13.0",
"react-router": "^7.8.1",
"react-router-hono-server": "2.21.0",
"react-stately": "^3.38.0",
"remix-utils": "^8.7.0",
"remix-utils": "^8.8.0",
"tailwind-merge": "^3.3.0",
"undici": "^7.10.0",
"usehooks-ts": "^3.1.1",
@@ -65,7 +65,7 @@
},
"devDependencies": {
"@biomejs/biome": "^1.9.4",
"@react-router/dev": "^7.6.1",
"@react-router/dev": "^7.8.1",
"@tailwindcss/vite": "^4.1.8",
"@types/node": "^22.15.17",
"@types/websocket": "^1.0.10",
@@ -73,7 +73,7 @@
"js-yaml": "^4.1.0",
"lefthook": "^1.11.13",
"postcss": "^8.5.4",
"react-router-dom": "^7.6.1",
"react-router-dom": "^7.8.1",
"react-scan": "^0.3.4",
"tailwindcss": "^4.1.8",
"tailwindcss-animate": "^1.0.7",
@@ -90,9 +90,6 @@
"pnpm": ">=10.4 <11"
},
"pnpm": {
"patchedDependencies": {
"react-router-hono-server": "patches/react-router-hono-server.patch"
},
"supportedArchitectures": {
"os": ["current", "linux"],
"cpu": ["x64", "arm64"]
-34
View File
@@ -1,34 +0,0 @@
diff --git a/dist/adapters/node.js b/dist/adapters/node.js
index 966604f94ca8528b684ef95fe7891c2e6352561b..8222cf31333668f8c2ebe65986b6ab9a3711b587 100644
--- a/dist/adapters/node.js
+++ b/dist/adapters/node.js
@@ -46,16 +46,25 @@ async function createHonoServer(options) {
}
await mergedOptions.beforeAll?.(app);
app.use(
- `/${import.meta.env.REACT_ROUTER_HONO_SERVER_ASSETS_DIR}/*`,
+ `/${__PREFIX__}${import.meta.env.REACT_ROUTER_HONO_SERVER_ASSETS_DIR}/*`,
cache(60 * 60 * 24 * 365),
// 1 year
- serveStatic({ root: clientBuildPath, ...mergedOptions.serveStaticOptions?.clientAssets })
+ serveStatic({
+ root: clientBuildPath,
+ ...mergedOptions.serveStaticOptions?.clientAssets,
+ rewriteRequestPath: path => path.replace(__PREFIX__, "/")
+ })
);
+ app.use(__PREFIX__, (c) => c.redirect(`${__PREFIX__}/`));
app.use(
- "*",
+ `${__PREFIX__}/*`,
cache(60 * 60),
// 1 hour
- serveStatic({ root: PRODUCTION ? clientBuildPath : "./public", ...mergedOptions.serveStaticOptions?.publicAssets })
+ serveStatic({
+ root: PRODUCTION ? clientBuildPath : "./public",
+ ...mergedOptions.serveStaticOptions?.publicAssets,
+ rewriteRequestPath: path => path.replace(__PREFIX__, "/")
+ })
);
if (mergedOptions.defaultLogger) {
app.use("*", logger());
+1166 -1049
View File
File diff suppressed because it is too large Load Diff
+3
View File
@@ -35,6 +35,9 @@ export default defineConfig(({ isSsrBuild }) => ({
host: server.host,
port: server.port,
},
build: {
target: 'esnext',
},
ssr: {
target: 'node',
noExternal: isSsrBuild ? ['@libsql/client'] : undefined,