{"id":"36bf63f65ceeec71","repo":"vitejs/vite","slug":"unsupported-dependency-type-dep-type","errorCode":null,"errorMessage":"Unsupported dependency type: ${dep.type}","messagePattern":"Unsupported dependency type: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/vite/src/node/plugins/css.ts","lineNumber":3484,"sourceCode":"        }\n\n        css = css.replace(\n          dep.placeholder,\n          // lightningcss always generates `url(\"placeholder\")`\n          // (`url('placeholder')`, `url(placeholder)` is not generated)\n          // so escape double quotes\n          () => replaceUrl.replaceAll('\"', '\\\\\"'),\n        )\n        break\n      }\n      case 'import': {\n        // use a function replacer so `$` sequences in the URL are inserted\n        // verbatim instead of being interpreted as replacement patterns\n        css = css.replace(dep.placeholder, () => dep.url)\n        break\n      }\n      default:\n        throw new Error(\n          `Unsupported dependency type: ${(dep satisfies never as any).type}`,\n        )\n    }\n  }\n\n  let modules: Record<string, string> | undefined\n  if ('exports' in res && res.exports) {\n    modules = {}\n    // https://github.com/parcel-bundler/lightningcss/issues/291\n    const sortedEntries = Object.entries(res.exports).sort((a, b) =>\n      a[0].localeCompare(b[0]),\n    )\n    for (const [key, value] of sortedEntries) {\n      modules[key] = value.name\n      // https://lightningcss.dev/css-modules.html#class-composition\n      for (const c of value.composes) {\n        modules[key] += ' ' + c.name\n      }","sourceCodeStart":3466,"sourceCodeEnd":3502,"githubUrl":"https://github.com/vitejs/vite/blob/89620f09afcfef6b35e7bb8660132ab5b4d0cd3b/packages/vite/src/node/plugins/css.ts#L3466-L3502","documentation":"An exhaustiveness guard in the lightningcss dependency-replacement loop. After lightningcss analyzes a CSS file it returns dependencies typed as `external-url`/`glob-import`/`url`/`import`; the `default` branch (with `satisfies never`) throws if a dependency has any other type. A hit means the installed lightningcss version emits a dependency shape Vite does not recognize.","triggerScenarios":"A dependency object from `lightningcss`'s `transform`/`bundle` result has a `type` not in the handled set, reaching the `default` case of the switch.","commonSituations":"Version skew between Vite and `lightningcss` (a newer lightningcss added a new dependency type), or a manually pinned/patched lightningcss version emitting different shapes.","solutions":["Align the `lightningcss` version with the one Vite depends on (check Vite's `package.json`).","Upgrade Vite to a release that supports your lightningcss version.","If pinning lightningcss yourself, downgrade/upgrade to match Vite's expected dependency types."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import { readFileSync } from 'node:fs';\n\nfunction checkLightningcssCompat() {\n  const vitePkg = JSON.parse(readFileSync('node_modules/vite/package.json','utf8'));\n  const lcPkg = JSON.parse(readFileSync('node_modules/lightningcss/package.json','utf8'));\n  // ensure lightningcss major matches vite's declared range\n  console.log('vite lightningcss range:', vitePkg.dependencies?.lightningcss, 'installed:', lcPkg.version);\n}\n// checkLightningcssCompat();","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Do not pin a `lightningcss` version ahead of Vite's supported range.","Upgrade Vite when adopting newer lightningcss releases.","Let Vite control the lightningcss version unless you have a specific reason."],"tags":["css","lightningcss","internal","version-mismatch"],"analyzedSha":"89620f09afcfef6b35e7bb8660132ab5b4d0cd3b","analyzedAt":"2026-08-03T19:28:02.920Z","schemaVersion":2}