{"record":{"id":"768909f032203b37","repo":"vitejs/vite","slug":"rolldownoptions-input-should-not-be-an-html-file-w","errorCode":null,"errorMessage":"rolldownOptions.input should not be an html file when building for SSR. Please specify a dedicated SSR entry.","messagePattern":"rolldownOptions\\.input should not be an html file when building for SSR\\. Please specify a dedicated SSR entry\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/vite/src/node/build.ts","lineNumber":628,"sourceCode":"  const input = libOptions\n    ? options.rolldownOptions.input ||\n      (typeof libOptions.entry === 'string'\n        ? resolve(libOptions.entry)\n        : Array.isArray(libOptions.entry)\n          ? libOptions.entry.map(resolve)\n          : Object.fromEntries(\n              Object.entries(libOptions.entry!).map(([alias, file]) => [\n                alias,\n                resolve(file),\n              ]),\n            ))\n    : typeof options.ssr === 'string'\n      ? resolve(options.ssr)\n      : options.rolldownOptions.input ||\n        (topLevelInput ?? resolve('index.html'))\n\n  if (ssr && typeof input === 'string' && input.endsWith('.html')) {\n    throw new Error(\n      `rolldownOptions.input should not be an html file when building for SSR. ` +\n        `Please specify a dedicated SSR entry.`,\n    )\n  }\n  if (options.cssCodeSplit === false) {\n    const inputs =\n      typeof input === 'string'\n        ? [input]\n        : Array.isArray(input)\n          ? input\n          : Object.values(input)\n    if (inputs.some((input) => input.endsWith('.css'))) {\n      throw new Error(\n        `When \"build.cssCodeSplit: false\" is set, \"rolldownOptions.input\" should not include CSS files.`,\n      )\n    }\n  }\n","sourceCodeStart":610,"sourceCodeEnd":646,"githubUrl":"https://github.com/vitejs/vite/blob/b4d66fee14d970f45b8a6f3d7d6aee73ca9b88ab/packages/vite/src/node/build.ts#L610-L646","documentation":"When building for SSR (`environment.config.consumer === 'server'`), `resolveRolldownOptions` checks the resolved input: if it is a single string ending in `.html`, the build throws. HTML entries are for the browser; an SSR build needs a JavaScript/TS entry module, so the config is rejected with a directive to specify a dedicated SSR entry.","triggerScenarios":"Setting `build.ssr: true` (or building an environment whose consumer is `server`) while the resolved input is an HTML file - typically the default `index.html` left because no SSR entry was configured. Also triggered by explicitly passing `rolldownOptions.input: 'index.html'` for an SSR build.","commonSituations":"Switching an app to SSR but forgetting to set `build.ssr` to a server entry path. Setting `ssr: true` (boolean) without an entry and relying on the default HTML input. Mixing SPA HTML entry with SSR build target.","solutions":["Set `build.ssr` to a server entry file: `build: { ssr: 'src/entry-server.ts' }`.","Or set `build.rollupOptions.input` (the resolved input) to a `.js`/`.ts` server entry instead of `index.html`.","Make sure `rolldownOptions.input` is not a `.html` path when targeting the SSR/server consumer."],"exampleFix":"// before\nbuild: { ssr: true } // falls back to index.html -> throws\n// after\nbuild: { ssr: 'src/entry-server.ts' }","handlingStrategy":"validation","validationCode":"function assertSsrEntryNotHtml(cfg: { build?: { ssr?: unknown }; rollupOptions?: { input?: unknown } }) {\n  const ssr = cfg.build?.ssr\n  const input = cfg.rollupOptions?.input\n  const resolvedInput = typeof ssr === 'string' ? ssr : input\n  if (resolvedInput != null && typeof resolvedInput === 'string' && resolvedInput.endsWith('.html')) {\n    throw new Error('SSR build input must not be an HTML file - set build.ssr to a .ts/.js entry')\n  }\n}","typeGuard":"function ssrEntryIsNotHtml(cfg: any): boolean {\n  const i = typeof cfg?.build?.ssr === 'string' ? cfg.build.ssr : cfg?.rollupOptions?.input\n  return !(typeof i === 'string' && i.endsWith('.html'))\n}","tryCatchPattern":null,"preventionTips":["Set build.ssr to a server .ts/.js entry file, not the SPA index.html.","Don't pass rolldownOptions.input as an HTML file for SSR/server consumer builds."],"tags":["build","ssr","config-validation","entry","rolldown"],"backgroundTag":null,"analyzedSha":"b4d66fee14d970f45b8a6f3d7d6aee73ca9b88ab","analyzedAt":"2026-08-11T11:49:19.515Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}