좀 많은게 바뀐거 같아요

This commit is contained in:
imnyang 2025-05-07 22:49:43 +09:00
commit 0dfe8ee371
29 changed files with 505 additions and 1106 deletions

View file

@ -1,6 +1,5 @@
import { serve } from "bun";
import index from "./index.html";
import serveStatic from "serve-static-bun";
// Parse command line arguments for port
const args = process.argv.slice(2);
@ -8,14 +7,8 @@ const portArgIndex = args.findIndex(arg => arg === "--port");
const port = portArgIndex !== -1 && args[portArgIndex + 1] ?
parseInt(args[portArgIndex + 1]) : 3000;
const server = serve({
development: {
// New: enable console log streaming
console: true,
// Enable hot module reloading
hmr: true,
},
const server = serve({
port: port,
routes: {
// Serve index.html for all unmatched routes.
@ -30,7 +23,21 @@ const server = serve({
},
),
},
development: process.env.NODE_ENV !== "production",
development: process.env.NODE_ENV !== "production" && {
// Enable browser hot reloading in development
hmr: true,
// Echo console logs from the browser to the server
console: true,
},
});
console.log(`🚀 Server running at ${server.url}`);
console.clear();
if (process.env.NODE_ENV !== "production") {
console.log(`\x1b[45m Dev \x1b[0m\x1b[35m Bun v${Bun.version}\x1b[0m`);
} else {
console.log(`\x1b[0m\x1b[35m Bun v${Bun.version}\x1b[0m`);
}
console.log(`\n\x1b[34m→ \x1b[35m${server.url}\x1b[0m`);