Compatibility
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 binding is for default Node based environments.wasm andwasm-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:
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:
Used to render a HTML vNode tree into OG Images.
This is the default renderer, and works on all environments.
resvg
Supports:
Used to transform SVGs into PNGs. This should work on all environments.
When installing using the
sharp
Supports:
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:
Used to support
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 installchromium 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 sizesharp - can't be used due to some post-install scripts issue
Vercel Edge, Netlify Edge, Cloudflare Pages
chromium - can't be used, no WASM supportsharp - can't be used, no WASM support
Cloudflare Workers
chromium - can't be used, no WASM supportsharp - can't be used, no WASM supportcss-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 supportsharp - can't be used, no WASM support
Provider Examples
All examples are generated from the Nuxt OG Image Playground GitHub repo.