- Create
index.ts
:
import { createServer } from "node:http";
import next from "next";
const dev = process.env.NODE_ENV !== "production";
const app = next({ dev, turbo: true, turbopack: true });
const handle = app.getRequestHandler();
app.prepare().then(() => {
createServer((req, res) => {
try {
handle(req, res);
} catch(e: any) {
console.log(e.message)
}
}).listen(3000)
console.log("Server is running on http://localhost:3000");
});
- Run the following command in the terminal, change --target to match your system:
bun build --target=bun-darwin-x64 --external=uglify-js --minify --compile index.ts && ll index && ./index