Skip to content

Allow Nitro modules to register Vite DevTools integrations #4250

Description

@onmax

Describe the feature

When using nitro/vite, it would be useful if Nitro modules could contribute integrations to the outer Vite plugin context.

A concrete case is Vite DevTools. A Nitro module can register server routes during Nitro setup, but it cannot currently register a Vite DevTools panel because that requires a root Vite plugin with:

{
  devtools: {
    setup(ctx) {
      ctx.docks.register(...)
    }
  }
}

Today this works only if users add a separate root Vite plugin:

plugins: [
  DevTools(),
  someVitePluginWithDevtools(),
  nitro(),
]

But it would be helpful for a Nitro module used through nitro/vite to expose that dev-only Vite integration automatically, so users can keep:

plugins: [
  DevTools(),
  nitro(),
]

Possible shape:

  • allow Nitro modules to contribute outer Vite plugins
  • or expose a specific hook for Vite DevTools integrations
  • or provide another recommended interop path for this case

Is there already a supported way to do this? If not, would Nitro be open to a small PR for this kind of interop?

Related context:

Additional information

  • Would you be willing to help implement this feature?

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