vitejs/vite · error · Error
Vite does not support "rolldownOptions.output.file". Please
Error message
Vite does not support "rolldownOptions.output.file". Please use "rolldownOptions.output.dir" and "rolldownOptions.output.entryFileNames" instead.
What it means
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.
Source
Thrown at packages/vite/src/node/build.ts:714
environment.getTopLevelConfig().ssr?.target === 'webworker'
// For webworker SSR with platform: 'browser', external CJS require() calls
// need to be converted to ESM imports since createRequire is not available.
if (isSsrTargetWebworkerEnvironment) {
plugins.push(esmExternalRequirePlugin())
}
const buildOutputOptions = (output: OutputOptions = {}): OutputOptions => {
// @ts-expect-error See https://github.com/vitejs/vite/issues/5812#issuecomment-984345618
if (output.output) {
logger.warn(
`You've set "rolldownOptions.output.output" in your config. ` +
`This is deprecated and will override all Vite.js default output options. ` +
`Please use "rolldownOptions.output" instead.`,
)
}
if (output.file) {
throw new Error(
`Vite does not support "rolldownOptions.output.file". ` +
`Please use "rolldownOptions.output.dir" and "rolldownOptions.output.entryFileNames" instead.`,
)
}
if (output.sourcemap) {
logger.warnOnce(
colors.yellow(
`Vite does not support "rolldownOptions.output.sourcemap". ` +
`Please use "build.sourcemap" instead.`,
),
)
}
const format = output.format || 'es'
const jsExt =
(ssr && !isSsrTargetWebworkerEnvironment) || libOptions
? resolveOutputJsExtension(
format,View on GitHub (pinned to 89620f09af)
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.
Example fix
// before
build: { rolldownOptions: { output: { file: 'dist/my-lib.js', format: 'es' } } }
// after
build: { outDir: 'dist', rolldownOptions: { output: { dir: 'dist', entryFileNames: 'my-lib.js', format: 'es' } } } Defensive patterns
Strategy: validation
Validate before calling
const outputs = config.build?.rolldownOptions?.output
const arr = Array.isArray(outputs) ? outputs : outputs ? [outputs] : []
if (arr.some((o: any) => o?.file)) {
throw new Error('rolldownOptions.output.file is not supported; use dir + entryFileNames')
} Type guard
function usesSupportedOutput(outputs: unknown): boolean {
const arr = Array.isArray(outputs) ? outputs : outputs ? [outputs] : []
return !arr.some((o: any) => o?.file)
} Prevention
- 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.
When it happens
Trigger: Setting build.rolldownOptions.output.file (e.g. { file: 'dist/bundle.js' }) — typically copied from a standalone Rollup/Rolldown config.
Common situations: Porting a rollup.config.js that uses output.file into Vite's rolldownOptions; expecting single-file output behaviour.
Related errors
- Entries in "build.rolldownOptions.output" must specify "name
- multiple output options are not supported in dev mode
- No environment found
- Either "build.lib.entry" or the top-level "input" option is
- rolldownOptions.input should not be an html file when buildi
AI-assisted analysis of vitejs/vite@89620f09af (2026-08-03).
Data as JSON: /data/errors/3229c6eae9319de8.json.
Report an issue: GitHub.