refactor: fix index.html path and vite config for correct build
This commit is contained in:
		@@ -12,4 +12,5 @@ export default defineConfig({
 | 
				
			|||||||
      input: "index.html",
 | 
					      input: "index.html",
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 | 
					  root: ".", // index.html を frontend ディレクトリ直下に置いている前提
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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}`);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user