mirror of
https://github.com/gosticks/magento-destroyers.git
synced 2025-10-16 11:55:43 +00:00
33 lines
826 B
TypeScript
33 lines
826 B
TypeScript
// Following CLAUDE.md instructions for serving HTML with Bun
|
|
import indexHtml from "./build/index.html";
|
|
|
|
Bun.serve({
|
|
port: 3001,
|
|
routes: {
|
|
"/": indexHtml,
|
|
// Serve static files
|
|
"/*": async (req) => {
|
|
const url = new URL(req.url);
|
|
const path = url.pathname;
|
|
|
|
try {
|
|
// Try to serve file from build directory
|
|
const file = Bun.file(`./build${path}`);
|
|
if (await file.exists()) {
|
|
return new Response(file);
|
|
}
|
|
} catch (e) {
|
|
// File not found
|
|
}
|
|
|
|
// Fallback to index.html for client-side routing
|
|
return new Response(Bun.file("./build/index.html"));
|
|
}
|
|
},
|
|
development: {
|
|
hmr: false, // Disable HMR for production build
|
|
console: true,
|
|
}
|
|
});
|
|
|
|
console.log("Server running at http://localhost:3001"); |