使用 create-next-app
初始化 Next.js 应用。这将搭建一个新的 Next.js 项目并自动安装依赖项。
bun create next-app
✔ What is your project named? … my-app
✔ Would you like to use TypeScript with this project? … No / Yes
✔ Would you like to use ESLint with this project? … No / Yes
✔ Would you like to use `src/` directory with this project? … No / Yes
✔ Would you like to use experimental `app/` directory with this project? … No / Yes
✔ What import alias would you like configured? … @/*
Creating a new Next.js app in /path/to/my-app.
您可以使用 `--example` 标志指定启动器模板。
bun create next-app --example with-supabase
✔ What is your project named? … my-app
...
要使用 Bun 启动开发服务器,请从项目根目录运行 bun --bun run dev
。
cd my-app
bun --bun run dev
要改为使用 Node.js 运行开发服务器,请省略 `--bun`。
cd my-app
bun run dev
在浏览器中打开 https://127.0.0.1:3000 以查看结果。您对 (pages/app)/index.tsx
所做的任何更改都将在浏览器中热重载。