{"record":{"id":"3f3b9360401de022","repo":"vitejs/vite","slug":"multiple-output-options-are-not-supported-in-dev-m","errorCode":null,"errorMessage":"multiple output options are not supported in dev mode","messagePattern":"multiple output options are not supported in dev mode","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/vite/src/node/server/bundledDev.ts","lineNumber":125,"sourceCode":"\n  get hasBuildOutput(): boolean {\n    return (\n      this.memoryFiles.size > 1 ||\n      (this.memoryFiles.size === 1 &&\n        !this.memoryFiles.has(BUNDLED_DEV_CLIENT_FILENAME))\n    )\n  }\n\n  async listen(): Promise<void> {\n    this._closed = false\n    debug?.('INITIAL: setup bundle options')\n    const rolldownOptions = await this.getRolldownOptions()\n    // NOTE: only single outputOptions is supported here\n    if (\n      Array.isArray(rolldownOptions.output) &&\n      rolldownOptions.output.length > 1\n    ) {\n      throw new Error('multiple output options are not supported in dev mode')\n    }\n    const outputOptions = (\n      Array.isArray(rolldownOptions.output)\n        ? rolldownOptions.output[0]\n        : rolldownOptions.output\n    )!\n\n    this.environment.hot.on(\n      'vite:client-connected',\n      async (payload, client) => {\n        this.clients.setupIfNeeded(client, payload.clientId)\n        this.devEngine.registerClient(payload.clientId)\n      },\n    )\n    this.environment.hot.on('vite:client:connect', (_payload, client) => {\n      // Replay the cached build error to freshly connected clients.\n      if (this.lastBuildError) {\n        debug?.('REPLAY: replaying last build error to newly connected client')","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/vitejs/vite/blob/b4d66fee14d970f45b8a6f3d7d6aee73ca9b88ab/packages/vite/src/node/server/bundledDev.ts#L107-L143","documentation":"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.","triggerScenarios":"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.","commonSituations":"Library-style configs copied into an app, or plugins that push multiple outputs. With bundled dev the single-output assumption is broken.","solutions":["Reduce build.rollupOptions.output to a single output object when using bundled dev.","Disable bundled dev (remove experimental.bundledDev / isBundled) if you need multiple outputs.","Move multi-output config into a separate build-only config that does not affect dev.","Confirm no plugin is injecting extra output entries."],"exampleFix":"// before\nbuild: { rollupOptions: { output: [{ format: 'es' }, { format: 'cjs' }] } }\nexperimental: { bundledDev: true }\n// after\nbuild: { rollupOptions: { output: { format: 'es' } } }\nexperimental: { bundledDev: true }","handlingStrategy":"validation","validationCode":"function assertSingleOutput(output) {\n  if (Array.isArray(output) && output.length > 1) {\n    throw new Error('Bundled dev requires a single rollup output')\n  }\n}\nassertSingleOutput(config.build?.rollupOptions?.output)","typeGuard":"function isSingleOutput(output): boolean {\n  return !Array.isArray(output) || output.length <= 1\n}","tryCatchPattern":null,"preventionTips":["Use one rollup output for app builds.","Separate multi-output library builds into a distinct config.","Disable bundled dev if multi-output is required."],"tags":["bundled-dev","rollup","output","experimental"],"backgroundTag":null,"analyzedSha":"b4d66fee14d970f45b8a6f3d7d6aee73ca9b88ab","analyzedAt":"2026-08-11T11:49:19.515Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}