refactor: fix index.html path and vite config for correct build

This commit is contained in:
2025-06-04 11:08:33 +09:00
parent 4bc0c4ce7f
commit fff7de8184
2 changed files with 3 additions and 2 deletions

View File

@ -12,4 +12,5 @@ export default defineConfig({
input: "index.html", input: "index.html",
}, },
}, },
root: ".", // index.html を frontend ディレクトリ直下に置いている前提
}); });

View File

@ -120,7 +120,7 @@ app.get("/", async (c) => {
// フォールバックとして index.html明示的なパス // フォールバックとして index.html明示的なパス
app.get("/index.html", async (c) => { app.get("/index.html", async (c) => {
const indexPath = path.join(frontendBuildDir, "server", "app", "index.html"); const indexPath = path.join(frontendBuildDir, "index.html");
const file = Bun.file(indexPath); const file = Bun.file(indexPath);
if (await file.exists()) { if (await file.exists()) {
console.log(`Serving index.html from ${indexPath}`); console.log(`Serving index.html from ${indexPath}`);
@ -132,7 +132,7 @@ app.get("/index.html", async (c) => {
// その他のパスも index.html へフォールバック // その他のパスも index.html へフォールバック
app.get("*", async (c) => { app.get("*", async (c) => {
const indexPath = path.join(frontendBuildDir, "server", "app", "index.html"); const indexPath = path.join(frontendBuildDir, "index.html");
const file = Bun.file(indexPath); const file = Bun.file(indexPath);
if (await file.exists()) { if (await file.exists()) {
console.log(`Serving index.html from ${indexPath}`); console.log(`Serving index.html from ${indexPath}`);