vitejs/vite · error · Error

multiple output options are not supported in dev mode

Error message

multiple output options are not supported in dev mode

What it means

BundledDev.listen at packages/vite/src/node/server/bundledDev.ts:119 requires exactly one rolldown output entry in dev because it wires a single output to its in-memory HMR pipeline. If rolldownOptions.output is an array with more than one entry it throws.

Source

Thrown at packages/vite/src/node/server/bundledDev.ts:119

  private get devEngine(): DevEngine {
    if (!this._devEngine) {
      throw new Error(`dev engine was not yet initialized`)
    }
    return this._devEngine
  }

  private pendingPayloadFilenames = new Set<string>()

  async listen(): Promise<void> {
    this._closed = false
    debug?.('INITIAL: setup bundle options')
    const rolldownOptions = await this.getRolldownOptions()
    // NOTE: only single outputOptions is supported here
    if (
      Array.isArray(rolldownOptions.output) &&
      rolldownOptions.output.length > 1
    ) {
      throw new Error('multiple output options are not supported in dev mode')
    }
    const outputOptions = (
      Array.isArray(rolldownOptions.output)
        ? rolldownOptions.output[0]
        : rolldownOptions.output
    )!

    this.environment.hot.on(
      'vite:client-connected',
      async (payload, client) => {
        this.clients.setupIfNeeded(client, payload.clientId)
        this.devEngine.registerClient(payload.clientId)
      },
    )
    this.environment.hot.on('vite:client:connect', (_payload, client) => {
      // Replay the cached build error to freshly connected clients.
      if (this.lastBuildError) {
        debug?.('REPLAY: replaying last build error to newly connected client')

View on GitHub (pinned to 89620f09af)

Solutions

  1. Reduce build.rolldownOptions.output to a single object (not an array) when using bundled dev.
  2. Disable experimental.bundledDev if you genuinely need multiple outputs (e.g. library mode).
  3. Move the multi-output config into a build-only preset and use a separate dev config with one output.

Example fix

// before
export default defineConfig({
  experimental: { bundledDev: true },
  build: { rolldownOptions: { output: [{}, {}] } },
})

// after
export default defineConfig({
  experimental: { bundledDev: true },
  build: { rolldownOptions: { output: {} } },
})
Defensive patterns

Strategy: validation

Validate before calling

function assertSingleOutput(output: unknown, dev = false) {
  if (dev && Array.isArray(output) && output.length > 1) {
    throw new Error('bundledDev requires a single build.rolldownOptions.output entry')
  }
}

Prevention

When it happens

Trigger: Configuring build.rollupOptions/rolldownOptions.output as a multi-entry array (e.g. dual CJS/ESM, or multiple chunking strategies) while experimental.bundledDev is on; a plugin injecting a second output option during dev.

Common situations: Library-mode configs (which legitimately use multiple outputs) accidentally paired with bundled dev; copy-pasting a production build.output array into a config that also enables bundledDev.

Related errors


AI-assisted analysis of vitejs/vite@89620f09af (2026-08-03). Data as JSON: /data/errors/3f3b9360401de022.json. Report an issue: GitHub.