{"record":{"id":"3229c6eae9319de8","repo":"vitejs/vite","slug":"vite-does-not-support-rolldownoptions-output-file","errorCode":null,"errorMessage":"Vite does not support \"rolldownOptions.output.file\". Please use \"rolldownOptions.output.dir\" and \"rolldownOptions.output.entryFileNames\" instead.","messagePattern":"Vite does not support \"rolldownOptions\\.output\\.file\"\\. Please use \"rolldownOptions\\.output\\.dir\" and \"rolldownOptions\\.output\\.entryFileNames\" instead\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/vite/src/node/build.ts","lineNumber":718,"sourceCode":"    environment.getTopLevelConfig().ssr?.target === 'webworker'\n\n  // For webworker SSR with platform: 'browser', external CJS require() calls\n  // need to be converted to ESM imports since createRequire is not available.\n  if (isSsrTargetWebworkerEnvironment) {\n    plugins.push(esmExternalRequirePlugin())\n  }\n\n  const buildOutputOptions = (output: OutputOptions = {}): OutputOptions => {\n    // @ts-expect-error See https://github.com/vitejs/vite/issues/5812#issuecomment-984345618\n    if (output.output) {\n      logger.warn(\n        `You've set \"rolldownOptions.output.output\" in your config. ` +\n          `This is deprecated and will override all Vite.js default output options. ` +\n          `Please use \"rolldownOptions.output\" instead.`,\n      )\n    }\n    if (output.file) {\n      throw new Error(\n        `Vite does not support \"rolldownOptions.output.file\". ` +\n          `Please use \"rolldownOptions.output.dir\" and \"rolldownOptions.output.entryFileNames\" instead.`,\n      )\n    }\n    if (output.sourcemap) {\n      logger.warnOnce(\n        colors.yellow(\n          `Vite does not support \"rolldownOptions.output.sourcemap\". ` +\n            `Please use \"build.sourcemap\" instead.`,\n        ),\n      )\n    }\n\n    const format = output.format || 'es'\n    const jsExt =\n      (ssr && !isSsrTargetWebworkerEnvironment) || libOptions\n        ? resolveOutputJsExtension(\n            format,","sourceCodeStart":700,"sourceCodeEnd":736,"githubUrl":"https://github.com/vitejs/vite/blob/b4d66fee14d970f45b8a6f3d7d6aee73ca9b88ab/packages/vite/src/node/build.ts#L700-L736","documentation":"Vite post-processes output, so it forbids the rolldownOptions.output.file option that Rollup/Rolldown use to write a single bundle to an absolute filename. The check runs inside buildOutputOptions and instructs users to use dir plus entryFileNames instead, which Vite already fills in for you.","triggerScenarios":"Passing output.file (e.g. { file: 'dist/bundle.js' }) inside build.rolldownOptions.output. Common when porting a raw Rollup config into Vite.","commonSituations":"Developers migrating from rollup.config.js or copying examples from Rollup docs. Library authors who expect a single output file.","solutions":["Delete the output.file key; Vite derives the filename from outDir + entryFileNames.","For a library, use build.lib.fileName to control the single output name instead of output.file.","To pin a custom name, set build.rolldownOptions.output.entryFileNames (e.g. 'my-lib.js')."],"exampleFix":"// before\nbuild: {\n  rollupOptions: { output: { file: 'dist/bundle.js', format: 'es' } }\n}\n// after\nbuild: {\n  rollupOptions: { output: { dir: 'dist', entryFileNames: 'bundle.js', format: 'es' } }\n}","handlingStrategy":"validation","validationCode":"function stripOutputFile(rollupOptions) {\n  if (rollupOptions?.output?.file) {\n    const { file, ...rest } = rollupOptions.output;\n    return { ...rollupOptions, output: { ...rest, dir: rest.dir || 'dist', entryFileNames: file } };\n  }\n  return rollupOptions;\n}","typeGuard":"function outputHasNoFile(rollupOptions) {\n  const out = Array.isArray(rollupOptions?.output) ? rollupOptions.output[0] : rollupOptions?.output;\n  return !out || !('file' in out);\n}","tryCatchPattern":null,"preventionTips":["Never carry output.file over from a Rollup config; Vite owns output naming.","Use build.lib.fileName for library single-file output instead of output.file."],"tags":["build","config","rolldown","output"],"backgroundTag":null,"analyzedSha":"b4d66fee14d970f45b8a6f3d7d6aee73ca9b88ab","analyzedAt":"2026-08-11T11:49:19.515Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}