Skip to content

Config

Defined in: types.ts:182

Global configuration for the snapshot integration. Defines which pages to capture, default behavior, and Puppeteer launch settings.

const config: SnapshotIntegrationConfig = {
  pages: {
    '/': [{ outputPath: 'src/assets/home-og.png' }],
    '/about': [{ outputPath: 'src/assets/about-og.png' }],
  },
  defaults: {
    width: 1200,
    height: 630,
    overwrite: true,
  },
  launchOptions: {
    args: ['--no-sandbox', '--disable-setuid-sandbox'],
  },
};

optional defaults?: Omit<ScreenshotConfig, "outputPath">

Defined in: types.ts:213

Default configuration applied to all pages. Can be overridden per page in pages.

defaults: {
  width: 512,
  height: 512,
  overwrite: true,
}

optional launchOptions?: LaunchOptions

Defined in: types.ts:225

Options to pass to Puppeteer’s launch() method.

launchOptions: {
  args: ['--no-sandbox', '--disable-setuid-sandbox'],
}

pages: Record<string, ScreenshotConfig[]>

Defined in: types.ts:198

Map of page paths or external URLs to their screenshot configurations.

Keys can be:

  • A local page path (ex. '/', '/about') served via the local build server.
  • An absolute http:// or https:// URL loaded directly without the local server.
pages: {
  '/': [{ outputPath: 'src/assets/home-og.png' }],
  'https://johng.io': [{ outputPath: 'src/assets/external.png', width: 512, height: 512 }],
}

optional port?: number

Defined in: types.ts:237

Port for the local server during build. Used to render pages before screenshot generation.

4322
port: 8080