{"id":"8d6bd11a25bdb9f2","repo":"vitejs/vite","slug":"unsupported-target-entry","errorCode":null,"errorMessage":"Unsupported target \"${entry}\"","messagePattern":"Unsupported target \"(.+?)\"","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/vite/src/node/plugins/css.ts","lineNumber":3646,"sourceCode":"    const index = entry.search(versionRE)\n    if (index >= 0) {\n      const browser = map[entry.slice(0, index)]\n      if (browser === false) continue // No mapping available\n      if (browser) {\n        const [major, minor = 0] = entry\n          .slice(index)\n          .split('.')\n          .map((v) => parseInt(v, 10))\n        if (!isNaN(major) && !isNaN(minor)) {\n          const version = (major << 16) | (minor << 8)\n          if (!targets[browser] || version < targets[browser]!) {\n            targets[browser] = version\n          }\n          continue\n        }\n      }\n    }\n    throw new Error(`Unsupported target \"${entry}\"`)\n  }\n\n  convertTargetsCache.set(esbuildTarget, targets)\n  return targets\n}\n\nexport function resolveLibCssFilename(\n  libOptions: LibraryOptions,\n  root: string,\n  packageCache?: PackageCache,\n): string {\n  if (typeof libOptions.cssFileName === 'string') {\n    return `${libOptions.cssFileName}.css`\n  } else if (typeof libOptions.fileName === 'string') {\n    return `${libOptions.fileName}.css`\n  }\n\n  const packageJson = findNearestMainPackageData(root, packageCache)?.data","sourceCodeStart":3628,"sourceCodeEnd":3664,"githubUrl":"https://github.com/vitejs/vite/blob/89620f09afcfef6b35e7bb8660132ab5b4d0cd3b/packages/vite/src/node/plugins/css.ts#L3628-L3664","documentation":"Thrown by `convertTargets` when a target entry is not an `es*` version, not `esnext`, and does not map to a known browser. After stripping ES versions, each remaining entry is parsed for a browser+version; if the browser prefix is unknown or the version unparseable, the entry is rejected verbatim.","triggerScenarios":"A target string like `node14`, `deno1`, `ie11`, or a typo (`chromium99`) reaches the final `throw` at line 3646 because `map[entry.slice(0,index)]` is undefined/false and version parsing falls through.","commonSituations":"Setting `build.target`/CSS target to Node, Deno, or a non-browser environment (lightningcss targets are browser-only); an unrecognized browser alias; a target list copy-pasted from a non-Vite config.","solutions":["Use a supported browser target format (e.g. `chrome100`, `firefox80`, `safari14`, `edge85`, `opera67`, `ios14`).","Remove Node/Deno targets from the CSS/lightningcss target list — those are not browser targets.","Set the target to `'esnext'` or a supported ES year to bypass browser mapping.","Check the exact `entry` in the message and correct the spelling/format."],"exampleFix":"// before\nexport default defineConfig({ build: { target: ['node18', 'chrome100'] } });\n// after\nexport default defineConfig({ build: { target: ['chrome100'] } });","handlingStrategy":"validation","validationCode":"const SUPPORTED_BROWSERS = new Set(['chrome','edge','safari','ios','firefox','opera']);\n\nfunction validateBrowserTargets(target) {\n  for (const t of [].concat(target)) {\n    if (t === 'esnext') continue;\n    const m = /^([a-z]+)(\\d+)/.exec(t);\n    if (m && !SUPPORTED_BROWSERS.has(m[1])) {\n      throw new Error(`Unsupported browser target: ${t}`);\n    }\n  }\n}\n// validateBrowserTargets(config.build.target);","typeGuard":"function isSupportedBrowserTarget(t) {\n  const m = /^([a-z]+)(\\d+)/.exec(t);\n  return !!m && new Set(['chrome','edge','safari','ios','firefox','opera']).has(m[1]);\n}","tryCatchPattern":null,"preventionTips":["Use only browser targets lightningcss understands: chrome/edge/safari/ios/firefox/opera + major version.","Keep Node/Deno targets out of CSS/lightningcss target lists.","Validate target strings in config before building."],"tags":["css","lightningcss","build-target","config"],"analyzedSha":"89620f09afcfef6b35e7bb8660132ab5b4d0cd3b","analyzedAt":"2026-08-03T19:28:02.920Z","schemaVersion":2}