{"record":{"id":"84db432adaee31f6","repo":"slidevjs/slidev","slug":"loadtheme-is-no-longer-supported","errorCode":null,"errorMessage":"`loadTheme` is no longer supported.","messagePattern":"`loadTheme` is no longer supported\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/client/setup/shiki-options.ts","lineNumber":12,"sourceCode":"// This module also runs in the Node.js environment\n\nimport type { ResolvedSlidevUtils, ShikiContext, ShikiSetupReturn } from '@slidev/types'\nimport type { LanguageInput, ThemeInput, ThemeRegistrationAny } from 'shiki'\nimport { objectMap } from '@antfu/utils'\nimport { red, yellow } from 'ansis'\nimport { bundledLanguages, bundledThemes } from 'shiki'\n\nexport const shikiContext: ShikiContext = {\n  /** @deprecated */\n  loadTheme() {\n    throw new Error('`loadTheme` is no longer supported.')\n  },\n}\n\nexport function resolveShikiOptions(options: (ShikiSetupReturn | void)[]) {\n  const mergedOptions: Record<string, any> = Object.assign({}, ...options)\n\n  if ('theme' in mergedOptions && 'themes' in mergedOptions)\n    delete mergedOptions.theme\n\n  // Rename theme to themes when provided in multiple themes format, but exclude when it's a theme object.\n  if (mergedOptions.theme && typeof mergedOptions.theme !== 'string' && !mergedOptions.theme.name && !mergedOptions.theme.tokenColors) {\n    mergedOptions.themes = mergedOptions.theme\n    delete mergedOptions.theme\n  }\n\n  // No theme at all, apply the default\n  if (!mergedOptions.theme && !mergedOptions.themes) {\n    mergedOptions.themes = {","sourceCodeStart":1,"sourceCodeEnd":30,"githubUrl":"https://github.com/slidevjs/slidev/blob/0d798ace5828966d9f77f62094d5f7a971ad98f7/packages/client/setup/shiki-options.ts#L1-L30","documentation":"The legacy shikiContext.loadTheme() method is a stub that always throws. It was removed when Slidev migrated to a Shiki version where themes are supplied declaratively via the theme/themes options instead of being loaded imperatively at runtime.","triggerScenarios":"A theme, addon, or user setup calling shikiContext.loadTheme(name) - typically old code written against a pre-migration Slidev API.","commonSituations":"Outdated theme or addon not yet updated for the current Slidev; copy-pasted setup code from old tutorials; custom integrations that predate the themes-object API.","solutions":["Replace loadTheme() calls with a ShikiSetupReturn that declares themes via the themes/theme option","Upgrade the offending theme/addon to a current version","Remove the call if your theme is already declared in the shiki setup"],"exampleFix":"// before\nshikiContext.loadTheme('my-theme')\n// after\nreturn { theme: { name: 'my-theme', ... } }","handlingStrategy":"type-guard","validationCode":"if (typeof shikiContext.loadTheme === 'function') {\n  // legacy stub: avoid calling it; declare themes via ShikiSetupReturn instead\n}","typeGuard":"function hasModernShikiSetup(setup: any): setup is { theme?: string; themes?: Record<string, string> } {\n  return 'theme' in setup || 'themes' in setup\n}","tryCatchPattern":null,"preventionTips":["Never call shikiContext.loadTheme; declare themes via the setup return","Audit themes/addons for legacy loadTheme usage before upgrading Slidev"],"tags":["shiki","deprecated","theme","migration"],"backgroundTag":null,"analyzedSha":"0d798ace5828966d9f77f62094d5f7a971ad98f7","analyzedAt":"2026-08-12T17:10:56.221Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}