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 構建應用的更多信息。