Skip to content

add back vite optional peer dependency #4636

Closed

Description

@danielroe

since [email protected], a nuxt v5 project installed in a monorepo that also has vite 7 somewhere else in another package leads to this 500 error on every route:

Error: Missing field moduleType
  code: 'PLUGIN_ERROR', pluginCode: 'InvalidArg', plugin: 'builtin:vite-resolve'
  runnerError: ... at [email protected]/dist/runtime/internal/vite/dev-worker.mjs:114

this is due to dropping the optional vite peer dependency, which means the dev worker resolves whatever vite is available (without regard for version constraints). see nuxt/cli#1523 (failing job and fix).

I think vite should be declared as an optional peer as nitro imports it directly.

if anyone else hits this, a pnpm packageExtensions entry re-adding the optional peer unblocks it:

packageExtensions:
  nitro:
    peerDependencies:
      vite: '^7 || ^8'
    peerDependenciesMeta:
      vite:
        optional: true

Activity

  1. pi0 commented on Sep 17, 2026

    @pi0
    Member

    Nuxt integration can pass nitro({ vite: { path: import.meta.resolve("vite") } }) with exactly right Vite version (#4637)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions