slidevjs/slidev · error · Error

[slidev] Unsupported exporting format "${format}"

Error message

[slidev] Unsupported exporting format "${format}"

What it means

The exporter only supports four output formats: pdf, png, md, pptx. The final else branch catches any other value passed as the format argument.

Source

Thrown at packages/slidev/node/commands/export.ts:225

  const progress = createSlidevProgress(!perSlide)
  progress.start(pages.length)

  try {
    if (format === 'pdf') {
      await genPagePdf()
    }
    else if (format === 'png') {
      await genPagePng(output)
    }
    else if (format === 'md') {
      await genPageMd()
    }
    else if (format === 'pptx') {
      const buffers = await genPagePng(false)
      await genPagePptx(buffers)
    }
    else {
      throw new Error(`[slidev] Unsupported exporting format "${format}"`)
    }
  }
  finally {
    progress.stop()
    await browser.close()
  }

  const relativeOutput = slash(relative('.', output))
  return relativeOutput.startsWith('.') ? relativeOutput : `./${relativeOutput}`

  async function go(no: number | string, clicks?: string) {
    const query = new URLSearchParams()
    if (withClicks)
      query.set('print', 'clicks')
    else
      query.set('print', 'true')
    if (range)
      query.set('range', range)

View on GitHub (pinned to 0d798ace58)

Solutions

  1. Use one of pdf, png, md, or pptx
  2. For other image formats, export png and convert with an external tool

Example fix

// before
slidev export --format webp
// after
slidev export --format png
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED = new Set(['pdf', 'png', 'md', 'pptx'])
if (!SUPPORTED.has(format)) throw new Error(`Unsupported format: ${format}. Use one of: ${[...SUPPORTED].join(', ')}`)

Type guard

function isExportFormat(f: string): f is 'pdf' | 'png' | 'md' | 'pptx' {
  return ['pdf', 'png', 'md', 'pptx'].includes(f)
}

Prevention

When it happens

Trigger: Passing --format webp, --format jpg, or any unrecognized value to slidev export.

Common situations: Typos in the format flag, assuming additional formats (jpg/webp/gif) are supported, copy-pasting a wrong value.

Related errors


AI-assisted analysis of slidevjs/slidev@0d798ace58 (2026-08-12). Data as JSON: /api/errors/f78a85311727b822. Report an issue: GitHub.