{"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":119,"sourceCode":"  private get devEngine(): DevEngine {\n    if (!this._devEngine) {\n      throw new Error(`dev engine was not yet initialized`)\n    }\n    return this._devEngine\n  }\n\n  private pendingPayloadFilenames = new Set<string>()\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":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/vitejs/vite/blob/89620f09afcfef6b35e7bb8660132ab5b4d0cd3b/packages/vite/src/node/server/bundledDev.ts#L101-L137","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Reduce build.rolldownOptions.output to a single object (not an array) when using bundled dev.","Disable experimental.bundledDev if you genuinely need multiple outputs (e.g. library mode).","Move the multi-output config into a build-only preset and use a separate dev config with one output."],"exampleFix":"// before\nexport default defineConfig({\n  experimental: { bundledDev: true },\n  build: { rolldownOptions: { output: [{}, {}] } },\n})\n\n// after\nexport default defineConfig({\n  experimental: { bundledDev: true },\n  build: { rolldownOptions: { output: {} } },\n})","handlingStrategy":"validation","validationCode":"function assertSingleOutput(output: unknown, dev = false) {\n  if (dev && Array.isArray(output) && output.length > 1) {\n    throw new Error('bundledDev requires a single build.rolldownOptions.output entry')\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep build.rolldownOptions.output a single object (not an array) in dev configs.","Split library-mode multi-output configs from dev configs.","Disable experimental.bundledDev when multiple outputs are required."],"tags":["dev-server","bundled-dev","rolldown","output","config"],"analyzedSha":"89620f09afcfef6b35e7bb8660132ab5b4d0cd3b","analyzedAt":"2026-08-03T19:28:02.920Z","schemaVersion":2}