{"id":"2f81105f1612efa2","repo":"vitejs/vite","slug":"failed-to-resolve-rolldownoptions-input-value-j","errorCode":null,"errorMessage":"failed to resolve rolldownOptions.input value: ${JSON.stringify(p)}.","messagePattern":"failed to resolve rolldownOptions\\.input value: (.+?)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/vite/src/node/optimizer/scan.ts","lineNumber":231,"sourceCode":"async function computeEntries(environment: ScanEnvironment) {\n  let entries: string[] = []\n\n  const explicitEntryPatterns = environment.config.optimizeDeps.entries\n  const input =\n    environment.config.input ?? environment.config.build.rolldownOptions.input\n\n  if (explicitEntryPatterns) {\n    entries = await globEntries(explicitEntryPatterns, environment)\n  } else if (input) {\n    const resolvePath = async (p: string) => {\n      const id = (\n        await environment.pluginContainer.resolveId(p, undefined, {\n          isEntry: true,\n          scan: true,\n        })\n      )?.id\n      if (id === undefined) {\n        throw new Error(\n          `failed to resolve rolldownOptions.input value: ${JSON.stringify(p)}.`,\n        )\n      }\n      return id\n    }\n    if (typeof input === 'string') {\n      entries = [await resolvePath(input)]\n    } else if (Array.isArray(input)) {\n      entries = await Promise.all(input.map(resolvePath))\n    } else if (isObject(input)) {\n      entries = await Promise.all(Object.values(input).map(resolvePath))\n    } else {\n      throw new Error('invalid rolldownOptions.input value.')\n    }\n  } else {\n    entries = await globEntries('**/*.html', environment)\n  }\n","sourceCodeStart":213,"sourceCodeEnd":249,"githubUrl":"https://github.com/vitejs/vite/blob/89620f09afcfef6b35e7bb8660132ab5b4d0cd3b/packages/vite/src/node/optimizer/scan.ts#L213-L249","documentation":"Thrown during dependency scanning when `build.rolldownOptions.input` (or environment `input`) references a path that the Vite plugin container cannot resolve. Vite uses these inputs as scan entry points, so every entry must resolve to a real on-disk module or a plugin-provided virtual id. The error includes the offending path verbatim so you can see which input failed.","triggerScenarios":"In `computeEntries`, when `optimizeDeps.entries` is unset but `input` is configured, each input value is run through `pluginContainer.resolveId(p, undefined, { isEntry: true, scan: true })`. If that call returns `undefined` (no resolver claimed the id), the error is thrown.","commonSituations":"Typo in an entry path, entry pointing outside the project root without an alias, referencing a file that was deleted/moved, a virtual module id that no plugin handles during scan, or an absolute path whose extension is filtered out by `isScannable`.","solutions":["Verify the path printed in the message exists on disk and is spelled correctly.","Make sure each entry is resolvable from the project root (use a relative path like './src/main.ts' or an absolute path).","If the entry is virtual or non-standard, add a plugin `resolveId` hook that returns an id for it (with `scan: true` in the options).","If you do not need explicit scan entries, remove `build.rolldownOptions.input` and instead set `optimizeDeps.entries` to a glob."],"exampleFix":"// before (vite.config.ts)\nexport default defineConfig({\n  build: { rolldownOptions: { input: './src/main.tx' } }, // typo\n});\n// after\nexport default defineConfig({\n  build: { rolldownOptions: { input: './src/main.ts' } },\n});","handlingStrategy":"validation","validationCode":"import { existsSync } from 'node:fs';\nimport path from 'node:path';\n\nfunction validateInputs(input, root) {\n  const values =\n    typeof input === 'string'\n      ? [input]\n      : Array.isArray(input)\n        ? input\n        : input && typeof input === 'object'\n          ? Object.values(input)\n          : [];\n  for (const p of values) {\n    if (!existsSync(path.resolve(root, p))) {\n      throw new Error(`rolldownOptions.input does not exist: ${p}`);\n    }\n  }\n}\n// call before build: validateInputs(config.build.rolldownOptions?.input, config.root);","typeGuard":"function isViteInput(v) {\n  return (\n    typeof v === 'string' ||\n    (Array.isArray(v) && v.every((x) => typeof x === 'string')) ||\n    (v != null && typeof v === 'object' &&\n      Object.values(v).every((x) => typeof x === 'string'))\n  );\n}","tryCatchPattern":"try {\n  await build();\n} catch (e) {\n  if (/failed to resolve rolldownOptions\\.input value/.test(e.message)) {\n    const bad = e.message.match(/value: (.*)\\.$/)?.[1];\n    console.error('Fix or remove this input entry:', bad);\n  }\n  throw e;\n}","preventionTips":["Treat entry paths as code: keep them in config and lint them in CI.","Prefer relative entry paths and assert they resolve in a prebuild script.","Use TypeScript for vite.config and rely on the typed `InputOption` to catch shape mistakes."],"tags":["config","dep-optimizer","entry","resolve"],"analyzedSha":"89620f09afcfef6b35e7bb8660132ab5b4d0cd3b","analyzedAt":"2026-08-03T19:28:02.920Z","schemaVersion":2}