{"record":{"id":"2815b82cab6b0611","repo":"cypress-io/cypress","slug":"your-component-devserver-config-for-vite-is-missin","errorCode":null,"errorMessage":"Your component devServer config for vite is missing a required viteConfig property, since we could not automatically detect one.\\n Please add one to your ${config.cypressConfig.configFile}","messagePattern":"Your component devServer config for vite is missing a required viteConfig property, since we could not automatically detect one\\.\\\\n Please add one to your (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"npm/vite-dev-server/src/resolveConfig.ts","lineNumber":62,"sourceCode":"    } else if (typeof inlineViteConfig === 'object') {\n      resolvedOverrides = inlineViteConfig\n    }\n\n    // Set \"configFile: false\" to disable auto resolution of <project-root>/vite.config.js\n    resolvedOverrides = { configFile: false, ...resolvedOverrides }\n  } else {\n    const { findUp } = await import('find-up')\n\n    const configFile = await findUp(configFiles, { cwd: projectRoot })\n\n    if (!configFile) {\n      if (config.onConfigNotFound) {\n        config.onConfigNotFound('vite', projectRoot, configFiles)\n        // The config process will be killed from the parent, but we want to early exit so we don't get\n        // any additional errors related to not having a config\n        process.exit(0)\n      } else {\n        throw new Error(`Your component devServer config for vite is missing a required viteConfig property, since we could not automatically detect one.\\n Please add one to your ${config.cypressConfig.configFile}`)\n      }\n    }\n\n    debug('Resolved config file at', configFile, 'using root', projectRoot)\n\n    resolvedOverrides = { configFile }\n  }\n\n  const finalConfig = vite.mergeConfig(\n    resolvedOverrides,\n    makeCypressViteConfig(config, vite),\n  )\n\n  debug('The resolved server config is', JSON.stringify(finalConfig, null, 2))\n\n  return finalConfig\n}\n","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/cypress-io/cypress/blob/0d85fdc91230885bca0a91df278312800a48b727/npm/vite-dev-server/src/resolveConfig.ts#L44-L80","documentation":"Thrown by resolveConfig when no explicit viteConfig was passed to devServer AND findUp could not locate any Vite config file (the configFiles list) walking up from projectRoot, AND config.onConfigNotFound is not provided. Cypress tries to auto-detect vite.config.{js,ts,mjs,...}; if none exists and there is no custom not-found handler, it cannot build a Vite config and aborts, pointing you to your cypress config file.","triggerScenarios":"Configuring CT with `devServer: { bundler: 'vite' }` (no viteConfig) in a project that has no vite.config.* anywhere from projectRoot upward, and without supplying an onConfigNotFound callback in the devServer config.","commonSituations":"Adopting Cypress CT in a project that uses a non-standard config location (e.g. vite.config.js in a subfolder), a monorepo where vite config lives at the root but the spec projectRoot is deeper than findUp reaches, or a brand-new project with no Vite config yet.","solutions":["Create a vite.config.{js,ts,mjs} at or above your cypressConfig.projectRoot.","Or pass an explicit config: `devServer: { bundler: 'vite', viteConfig: { ... } }` (object or async function).","If you intentionally have no config, provide `devServer: { bundler: 'vite', viteConfig: { configFile: false } }` to skip auto-detection.","Supply onConfigNotFound in the devServer config to customize the missing-config path instead of throwing."],"exampleFix":"// before\ndevServer: { bundler: 'vite' }  // and no vite.config.* exists\n// after — option A: pass inline config\ndevServer: { bundler: 'vite', viteConfig: { server: { port: 5173 } } }\n// after — option B: create vite.config.ts at project root\nimport { defineConfig } from 'vite'\nexport default defineConfig({})","handlingStrategy":"validation","validationCode":"import { existsSync } from 'fs'\nimport { findUp } from 'find-up'\nconst hasViteConfig = async (root: string) => !!(await findUp(['vite.config.ts','vite.config.js','vite.config.mjs'], { cwd: root }))\nif (!(await hasViteConfig(projectRoot)) && !devServerConfig.viteConfig) throw new Error('Provide viteConfig or create vite.config.*')","typeGuard":"const hasInlineViteConfig = (c: any): boolean => !!c?.viteConfig","tryCatchPattern":null,"preventionTips":["Always pass viteConfig explicitly or keep a vite.config.* discoverable from projectRoot.","Provide onConfigNotFound in the devServer config to customize the missing-config path.","Document the expected config file location for your monorepo layout."],"tags":["vite","dev-server","config","resolve-config","filesystem"],"backgroundTag":null,"analyzedSha":"0d85fdc91230885bca0a91df278312800a48b727","analyzedAt":"2026-08-12T16:24:28.056Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}