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 computes rolldownOptions and only supports a single output. If rolldownOptions.output is an array with more than one entry, dev bundling cannot proceed and Vite throws. This reflects a limitation of the in-memory dev pipeline, which produces one set of memory files per build.

Solutions

  1. Reduce build.rollupOptions.output to a single output object when using bundled dev.
  2. Disable bundled dev (remove experimental.bundledDev / isBundled) if you need multiple outputs.
  3. Move multi-output config into a separate build-only config that does not affect dev.
  4. Confirm no plugin is injecting extra output entries.

Example fix

// before
build: { rollupOptions: { output: [{ format: 'es' }, { format: 'cjs' }] } }
experimental: { bundledDev: true }
// after
build: { rollupOptions: { output: { format: 'es' } } }
experimental: { bundledDev: true }
Defensive patterns

Strategy: validation

Validate before calling

function assertSingleOutput(output) {
  if (Array.isArray(output) && output.length > 1) {
    throw new Error('Bundled dev requires a single rollup output')
  }
}
assertSingleOutput(config.build?.rollupOptions?.output)

Type guard

function isSingleOutput(output): boolean {
  return !Array.isArray(output) || output.length <= 1
}

Prevention

When it happens

Trigger: Configuring build.rollupOptions.output as a multi-output array (e.g. to emit both CJS and ESM) while bundled dev is active (experimental.bundledDev or environment isBundled). listen() runs during server startup.

Common situations: Library-style configs copied into an app, or plugins that push multiple outputs. With bundled dev the single-output assumption is broken.

Related errors


AI-assisted analysis of vitejs/vite@b4d66fee14 (2026-08-11). Data as JSON: /api/errors/3f3b9360401de022. Report an issue: GitHub.

Appendix: source

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

  get hasBuildOutput(): boolean {
    return (
      this.memoryFiles.size > 1 ||
      (this.memoryFiles.size === 1 &&
        !this.memoryFiles.has(BUNDLED_DEV_CLIENT_FILENAME))
    )
  }

  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 b4d66fee14)