目前,Remix 开发服务器 (remix dev) 依赖于 Bun 尚未实现的 Node.js API。下面的指南使用 Bun 初始化项目并安装依赖项,但它使用 Node.js 来运行开发服务器。
使用 create-remix 初始化 Remix 应用。
bun create remix
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.org.cn/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 将用于运行开发服务器。
cd my-appbun run dev $ remix dev
💿 remix dev
info building...
info built (263ms)
Remix App Server started at https://:3000 (http://172.20.0.143:3000)打开 https://:3000 即可看到应用。对 app/routes/_index.tsx 的任何更改都会在浏览器中热重载。
要构建并启动您的应用,请在项目根目录下运行 bun run build,然后运行 bun run start。
bun run build $ remix build
info building... (NODE_ENV=production)
info built (158ms)bun start $ remix-serve ./build/index.js
[remix-serve] https://:3000 (http://192.168.86.237:3000)有关使用 Remix 构建应用的更多信息,请阅读 Remix 文档。