{"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":714,"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":696,"sourceCodeEnd":732,"githubUrl":"https://github.com/vitejs/vite/blob/89620f09afcfef6b35e7bb8660132ab5b4d0cd3b/packages/vite/src/node/build.ts#L696-L732","documentation":"In buildOutputOptions (build.ts:713), if an output entry has a file property set, Vite throws because it does not support rolldownOptions.output.file. Vite manages output filenames via dir + entryFileNames/chunkFileNames/assetFileNames, and a single file output conflicts with that pipeline.","triggerScenarios":"Setting build.rolldownOptions.output.file (e.g. { file: 'dist/bundle.js' }) — typically copied from a standalone Rollup/Rolldown config.","commonSituations":"Porting a rollup.config.js that uses output.file into Vite's rolldownOptions; expecting single-file output behaviour.","solutions":["Remove output.file and use output.dir together with entryFileNames to control the output name.","For a deterministic (non-hashed) name, set entryFileNames: '[name].js'.","Keep build.outDir for the directory and let Vite compute asset/chunk names."],"exampleFix":"// before\nbuild: { rolldownOptions: { output: { file: 'dist/my-lib.js', format: 'es' } } }\n// after\nbuild: { outDir: 'dist', rolldownOptions: { output: { dir: 'dist', entryFileNames: 'my-lib.js', format: 'es' } } }","handlingStrategy":"validation","validationCode":"const outputs = config.build?.rolldownOptions?.output\nconst arr = Array.isArray(outputs) ? outputs : outputs ? [outputs] : []\nif (arr.some((o: any) => o?.file)) {\n  throw new Error('rolldownOptions.output.file is not supported; use dir + entryFileNames')\n}","typeGuard":"function usesSupportedOutput(outputs: unknown): boolean {\n  const arr = Array.isArray(outputs) ? outputs : outputs ? [outputs] : []\n  return !arr.some((o: any) => o?.file)\n}","tryCatchPattern":null,"preventionTips":["Use build.outDir plus entryFileNames instead of output.file.","When porting a Rollup config, translate output.file to dir + entryFileNames.","Avoid single-file output expectations with Vite's build pipeline."],"tags":["build","output","config","rolldown"],"analyzedSha":"89620f09afcfef6b35e7bb8660132ab5b4d0cd3b","analyzedAt":"2026-08-03T19:28:02.920Z","schemaVersion":2}