diff options
author | 2023-08-21 21:34:03 -0700 | |
---|---|---|
committer | 2023-08-21 21:34:03 -0700 | |
commit | 3a45f2c71bb17fbad0168fa76b32ae0c8ee67935 (patch) | |
tree | 2b02a163ff489349108ad99c211e65ed77209554 /docs/guides/ecosystem | |
parent | 9eeb7bdbff72997709a9a4c6afb2910830d29842 (diff) | |
download | bun-3a45f2c71bb17fbad0168fa76b32ae0c8ee67935.tar.gz bun-3a45f2c71bb17fbad0168fa76b32ae0c8ee67935.tar.zst bun-3a45f2c71bb17fbad0168fa76b32ae0c8ee67935.zip |
Docs and types for v0.8.0 (#4199)
* Improve test documentation
* Update nodejs compat docs with tty
* Add debugger guide
* Document Bun.inspect.custom, improve bun test nav
* Address reviews
* Update Bun.file types
* Add Nuxt guide
* Add tty types
Diffstat (limited to 'docs/guides/ecosystem')
-rw-r--r-- | docs/guides/ecosystem/nuxt.md | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/docs/guides/ecosystem/nuxt.md b/docs/guides/ecosystem/nuxt.md new file mode 100644 index 000000000..bb0291754 --- /dev/null +++ b/docs/guides/ecosystem/nuxt.md @@ -0,0 +1,65 @@ +--- +name: Build an app with Nuxt and Bun +--- + +Bun supports [Nuxt](https://nuxt.com) out of the box. Initialize a Nuxt app with official `nuxi` CLI. + +```sh +$ bunx nuxi init my-nuxt-app +Nuxi 3.6.5 +✨ Nuxt project is created with v3 template. Next steps: + › cd my-nuxt-app + › Install dependencies with npm install or yarn install or pnpm install + › Start development server with npm run dev or yarn dev or pnpm run dev +``` + +--- + +Then move into the project directory and install dependencies. + +```sh +$ cd my-app +$ bun install +bun install v0.8.0 + + @nuxt/devtools@0.8.0 + + @types/node@18.17.6 + + nuxt@3.6.5 +Nuxi 3.6.5 +✔ Types generated in .nuxt + + 776 packages installed [1.72s] +``` + +--- + +To start the dev server, run `bun run dev` from the project root. This will execute the `nuxt dev` command (as defined in the `"dev"` script in `package.json`). + +{% callout %} +The `nuxt` CLI uses Node.js by default; passing the `--bun` flag forces the dev server to use the Bun runtime instead. +{% /callout %} + +``` +$ bun --bun run dev + $ nuxt dev +Nuxi 3.6.5 +Nuxt 3.6.5 with Nitro 2.5.2 + > Local: http://localhost:3000/ + > Network: http://192.168.0.21:3000/ + > Network: http://[fd8a:d31d:481c:4883:1c64:3d90:9f83:d8a2]:3000/ + +✔ Nuxt DevTools is enabled v0.8.0 (experimental) +ℹ Vite client warmed up in 547ms +✔ Nitro built in 244 ms +``` + +--- + +Once the dev server spins up, open [http://localhost:3000](http://localhost:3000) to see the app. The app will render Nuxt's built-in `WelcomePage` template component. + +To start developing your app, replace `<WelcomePage />` in `app.vue` with your own UI. + +{% image src="https://github.com/oven-sh/bun/assets/3084745/2c683ecc-3298-4bb0-b8c0-cf4cfaea1daa" caption="Demo Nuxt app running on localhost" /%} + +--- + +Refer to the [Nuxt website](https://nuxt.com/docs) for complete documentation. |