feat: nuxt 4 upgrade#3366
Conversation
🦋 Changeset detectedLatest commit: 2565a82 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Vite 7.3.1 (required by Nuxt 4.3.1) uses crypto.hash() which needs Node.js >= 21.7.0. Updated .nvmrc and engines field accordingly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The Nuxt 4 upgrade introduced Vite 7.3.1 into the workspace which was leaking into the docs app (still on Nuxt 3) during CI resolution, causing a "nitro.client.mjs not found" build error. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add hoistingLimits to preview/nuxt workspace so Nuxt 4 deps (@nuxt/kit, @nuxt/vite-builder, vite 7) stay isolated and don't pollute the root node_modules - Pin nitropack to 2.10.3 (root resolution + docs devDep) to avoid impound/cookie-es incompatibility with Nuxt 3's import protection - Add svgo as root devDependency (was previously resolved via hoisting) - Pin nitropack and vite in docs devDeps for explicit version control Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
| "installConfig": { | ||
| "hoistingLimits": "workspaces" | ||
| }, |
There was a problem hiding this comment.
(docs in workspaces issue)
Without it, Nuxt 4's @nuxt/kit@4.3.1, @nuxt/vite-builder@4.3.1, and vite@7.3.1 were hoisted to root node_modules, where nuxi would pick them up for the docs build instead of the correct Nuxt 3 versions
| "@storefront-ui/typography": "workspace:*", | ||
| "@changesets/assemble-release-plan@^6.0.4": "patch:@changesets/assemble-release-plan@npm%3A6.0.4#./.yarn/patches/@changesets-assemble-release-plan-npm-6.0.4-999d754646.patch" | ||
| "@changesets/assemble-release-plan@^6.0.4": "patch:@changesets/assemble-release-plan@npm%3A6.0.4#./.yarn/patches/@changesets-assemble-release-plan-npm-6.0.4-999d754646.patch", | ||
| "nitropack": "2.10.3" |
There was a problem hiding this comment.
(docs in workspaces issue)
the lockfile update bumped nitropack from 2.10.3 → 2.13.1, which added utils.azure.mjs importing cookie-es. Nuxt 3's impound plugin blocks this import because the regex pattern doesn't account for nitropack/node_modules/ paths.
Was previously resolved via hoisting from apps/preview/nuxt, now needs to be an explicit devDependency after hoisting isolation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Szymon-dziewonski
left a comment
There was a problem hiding this comment.
Looks great, thanks for this update!
Related issue
Closes #
Scope of work
nuxt@^4.3.0) while maintaining backward compatibility with Nuxt 3.nvmrc→22.14.0, engines →>=22.0.0) — required by Vite 7.3.1 (crypto.hash()API needs Node >= 21.7)hoistingLimits: "workspaces"onpreview/nuxt) to prevent@nuxt/kit@4,@nuxt/vite-builder@4, and Vite 7 from leaking into the docs build (still on Nuxt 3)nitropack@2.10.3to avoidimpound/cookie-esincompatibility with Nuxt 3's import protection rulessvgoas explicit root devDependency (was previously resolved via accidental hoisting)Important
I didn't upgrade docs, they still use Nuxt 3 (because sf-docs-base requires Nuxt 3). Because of that I needed to add few workarounds.
Screenshots of visual changes
N/A - no visual changes
Checklist