From 66c876478ef2b1b1f8330e4c3ae837fe72ee97dc Mon Sep 17 00:00:00 2001 From: d-kimsuon Date: Sun, 31 Aug 2025 17:17:41 +0900 Subject: [PATCH] chore: fix hono cleint port resolution --- dist/index.js | 2 -- package.json | 2 +- src/lib/api/client.ts | 6 +++++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/dist/index.js b/dist/index.js index d334531..d450dd7 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,5 +1,3 @@ #!/usr/bin/env node -process.env.PORT = "3400"; - import "./standalone/server.js"; diff --git a/package.json b/package.json index f62fda7..e0715da 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ }, "scripts": { "dev": "run-p 'dev:*'", - "dev:next": "next dev -p 3400 --turbopack", + "dev:next": "PORT=3400 next dev --turbopack", "build": "next build && cp -r public .next/standalone/ && cp -r .next/static .next/standalone/.next/", "lint": "run-s 'lint:*'", "lint:biome-format": "biome format .", diff --git a/src/lib/api/client.ts b/src/lib/api/client.ts index a22625b..57ae916 100644 --- a/src/lib/api/client.ts +++ b/src/lib/api/client.ts @@ -1,4 +1,8 @@ import { hc } from "hono/client"; import type { RouteType } from "../../server/hono/route"; -export const honoClient = hc("http://localhost:3400"); +export const honoClient = hc( + typeof window === "undefined" + ? `http://localhost:${process.env["PORT"] ?? 3000}/` + : "/" +);