NOTE
目前 Remix 开发服务器(`remix dev`)依赖于 Bun 尚未实现的 Node.js API。下面的指南 使用 Bun 初始化项目并安装依赖,但使用 Node.js 运行开发服务器。使用 create-remix 初始化一个 Remix 应用。
sh
bun create remixtxt
remix v1.19.3 💿 Let's build a better website...
dir Where should we create your new project?
./my-app
◼ Using basic template See https://remix.run/docs/en/main/guides/templates#templates for more
✔ Template copied
git Initialize a new git repository?
Yes
deps Install dependencies with bun?
Yes
✔ Dependencies installed
✔ Git initialized
done That's it!
Enter your project directory using cd ./my-app
Check out README.md for development and deploy instructions.要启动开发服务器,从项目根目录运行 bun run dev。这将使用 remix dev 命令启动开发服务器。请注意,将使用 Node.js 运行开发服务器。
sh
cd my-app
bun run devtxt
$ remix dev
💿 remix dev
info building...
info built (263ms)
Remix App Server started at http://localhost:3000 (http://172.20.0.143:3000)打开 http://localhost:3000 查看应用。你对 app/routes/_index.tsx 所做的任何更改都将在浏览器中热重载。
要构建和启动你的应用,运行 bun run build
sh
bun run buildtxt
$ remix build
info building... (NODE_ENV=production)
info built (158ms)然后从项目根目录运行 bun run start。
sh
bun starttxt
$ remix-serve ./build/index.js
[remix-serve] http://localhost:3000 (http://192.168.86.237:3000)阅读 Remix 文档 获取有关如何使用 Remix 构建应用的更多信息。