[ ] ๐ Documentation (updates to the documentation or readme)
[ ] ๐ Bug fix (a non-breaking change that fixes an issue)
[ ] ๐ Enhancement (improving an existing functionality)
[x] โจ New feature (a non-breaking change that adds functionality)
[ ] ๐งน Chore (updates to the build process or auxiliary tools and libraries)
[ ] โ ๏ธ Breaking change (fix or feature that would cause existing functionality to change)
๐ Description
There are cases where we want to deploy our Nuxt app as a server-side app and we want OG Images, but we don't want to host live runtime OG images due to the performance cost.
For this, we introduce the zeroRuntime config which will ensure all tree-shakable OG image code is removed for the final server output.
While the mode is called "Zero Runtime", there is still a slight overhead of ~30kb on the server build which is coming from:
Nuxt Site Config, we can't safely tree shake this at the moment.
Something else - Needs further investigation :thinking:
Benchmarks
Without OG Image
Nitro: 274kb
node_modules: 2.0mb
Client: 209kb
With OG Image - Default
Nitro: 1.6mb
node_modules: 25mb
Client: 211kb
With OG Image - Zero Runtime
Nitro: 306kb
node_modules: 2.0mb
Client: 210kb
:warning: Community Templates
When using zeroRuntime none of the community templates will be available in your final build, you must copy+paste any community template that you wish to use into your components/OgImage folder.
๐ Linked issue
https://github.com/nuxt-modules/og-image/issues/210
https://github.com/nuxt-modules/og-image/issues/162 (workaround) https://github.com/nuxt-modules/og-image/issues/193 (workaround)
โ Type of change
๐ Description
There are cases where we want to deploy our Nuxt app as a server-side app and we want OG Images, but we don't want to host live runtime OG images due to the performance cost.
For this, we introduce the
zeroRuntime
config which will ensure all tree-shakable OG image code is removed for the final server output.While the mode is called "Zero Runtime", there is still a slight overhead of ~30kb on the server build which is coming from:
Benchmarks
Without OG Image
Nitro: 274kb
Client: 209kb
With OG Image - Default
Nitro: 1.6mb
Client: 211kb
With OG Image - Zero Runtime
Nitro: 306kb
Client: 210kb
:warning: Community Templates
When using
zeroRuntime
none of the community templates will be available in your final build, you must copy+paste any community template that you wish to use into yourcomponents/OgImage
folder.