|
| 1 | +# Production Nuxt Playground |
| 2 | + |
| 3 | +A **standalone pnpm workspace** running a **Nuxt 5** app with **Nuxt DevTools |
| 4 | +4**, whose internal Vite DevTools dependency is overridden to the **local |
| 5 | +built dist** — so you can test how Vite DevTools behaves when it's running as |
| 6 | +Nuxt DevTools' own engine, rather than mounted directly as a Vite plugin. |
| 7 | + |
| 8 | +The playground at `playgrounds/production` installs `@vitejs/devtools` |
| 9 | +straight into a plain Vite app. This one exercises the other real-world |
| 10 | +integration path: Nuxt DevTools v4 (`@nuxt/devtools@^4.0.0-alpha.9`) depends |
| 11 | +directly on `@vitejs/devtools` and `@vitejs/devtools-kit`, so a Nuxt app with |
| 12 | +`devtools: { enabled: true }` gets Vite DevTools for free, through Nuxt |
| 13 | +DevTools. |
| 14 | + |
| 15 | +Nuxt 5 isn't published to the `nuxt` package's stable dist-tags yet, so |
| 16 | +`package.json` pulls it from Nuxt's [nightly release |
| 17 | +channel](https://nuxt.com/docs/guide/going-further/nightly-release-channel) |
| 18 | +via the `npm:nuxt-nightly@5x` alias — the same channel Nuxt itself documents |
| 19 | +for trying the next major early. Nuxt DevTools 4 (`@nuxt/devtools@^4.0.0-alpha.9`) |
| 20 | +is already on its regular dist-tags as a pre-release, so it's installed |
| 21 | +directly with no alias needed. |
| 22 | + |
| 23 | +## How it works |
| 24 | + |
| 25 | +`scripts/pack-local.mjs` builds the monorepo and packs the six published |
| 26 | +Vite DevTools packages into `.tarballs/`, exactly like `playgrounds/production` |
| 27 | +(it shares the same `scripts/pack-devtools-tarballs.mjs` implementation). |
| 28 | +Every run wipes and repacks under stable, version-agnostic names, then |
| 29 | +installs with `--force`, so the install always reflects the tarballs that |
| 30 | +were just packed, never a stale previous build. |
| 31 | + |
| 32 | +`pnpm-workspace.yaml` overrides `@vitejs/devtools`, `@vitejs/devtools-kit`, |
| 33 | +and every sibling package to those tarballs. Because `@nuxt/devtools` pulls |
| 34 | +those same two packages in as regular (non-`workspace:`) npm dependencies, |
| 35 | +the override reaches into Nuxt DevTools' own dependency tree and forces it to |
| 36 | +run on the exact Vite DevTools build under test here — not whatever version |
| 37 | +`@nuxt/devtools` has pinned on npm. Everything else (`nuxt`, `vue`, |
| 38 | +`@nuxt/devtools` itself, ...) resolves from the public registry, just like a |
| 39 | +real install. |
| 40 | + |
| 41 | +Its own `pnpm-workspace.yaml` keeps it isolated from the monorepo above, so a |
| 42 | +`pnpm install` here builds an independent dependency tree with its own lockfile. |
| 43 | + |
| 44 | +## Usage |
| 45 | + |
| 46 | +From this directory: |
| 47 | + |
| 48 | +```sh |
| 49 | +# Build the monorepo, pack the packages, and install them |
| 50 | +pnpm run setup |
| 51 | + |
| 52 | +# Start the Nuxt dev server (Nuxt DevTools panel) |
| 53 | +pnpm dev |
| 54 | + |
| 55 | +# Or produce a production build |
| 56 | +pnpm build |
| 57 | +``` |
| 58 | + |
| 59 | +To re-pack after changing package source without rebuilding untouched packages, |
| 60 | +`pnpm run setup` re-runs the turbo build (cached), repacks, and reinstalls. If |
| 61 | +you already have fresh `dist` output and only want to re-pack + reinstall: |
| 62 | + |
| 63 | +```sh |
| 64 | +pnpm run setup:no-build |
| 65 | +``` |
| 66 | + |
| 67 | +## Layout |
| 68 | + |
| 69 | +- `scripts/pack-local.mjs` — build + pack the published packages into `.tarballs/`, then install |
| 70 | +- `nuxt.config.ts` — a plain user config with `devtools: { enabled: true }` |
| 71 | +- `app/app.vue` — a minimal Nuxt app so the panels have real build/module data |
0 commit comments