Nuxt OG Image relies heavily on third-party packages that have different compatibility requirements.

Bindings

There are a number of bindings that can be used for each dependency: node, wasm, wasm-fs and false.

  • node binding is for default Node based environments.
  • wasm and wasm-fs bindings are used to run WebAssembly. They are mostly used for WebWorker support.
  • wasm-fs binding is for using WebAssembly in a development WebWorker development environment such as StackBlitz.
  • false disables the dependency.

Dependencies

chromium

Supports: node

Used to render browser screenshots.

This only works on Node based environments. However, it does not work on AWS Lambda as the Chromium binary is too large.

Due to the rendering times being slow, it's recommended to only use browser screenshots when prerendering them.

satori

Supports: node, wasm, wasm-fs

Used to render a HTML vNode tree into OG Images.

This is the default renderer, and works on all environments.

resvg

Supports: node, wasm, wasm-fs

Used to transform SVGs into PNGs. This should work on all environments.

When installing using the node binding, it can have issues resolving the correct binary. You may run into an issue like Cannot resolve "./resvgjs.android-arm64.node", in which case you should manually set the binding to wasm or wasm-fs.

sharp

Supports: node

Used to transform PNG to JPEG. This only works on Node based environments.

This is disabled by The dependency is quite heavy so it's disabled by default.

See the JPEGs guide for more information.

css-inline

Supports: node, wasm, wasm-fs

Used to support <style> tags within Vue SFCs.

Powered by css-inline.

Overriding compatibility

In some instances, it may be useful to override the compatibility, so you can toggle features or use more optimised bindings for your environment.

export default defineNuxtConfig({
  ogImage: {
    compatibility: {
      // disable chromium dependency for prerendering (skips the chromium install in CIs)
      prerender: {
        chromium: false
      }
    }
  }
})

Provider compatibility

Development

  • sharp - will use your local Sharp install
  • chromium will use your local Chromium install, if available

Prerendering

  • chromium - will use your local Chromium install or install a chromium binary if not found

AWS Lamdba, Netlify, Vercel

  • chromium - can't be used due to the binary size
  • sharp - can't be used due to some post-install scripts issue

Vercel Edge, Netlify Edge, Cloudflare Pages

  • chromium - can't be used, no WASM support
  • sharp - can't be used, no WASM support

Cloudflare Workers

  • chromium - can't be used, no WASM support
  • sharp - can't be used, no WASM support
  • css-inline - can't be used, no WASM support

There is an open issue for custom fonts and images being broken in Cloudflare Workers. Please reply to the issue if you need this fixed.

StackBlitz

  • chromium - can't be used, no WASM support
  • sharp - can't be used, no WASM support

Provider Examples

All examples are generated from the Nuxt OG Image Playground GitHub repo.

Did this page help you?