Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Zero Runtime mode #261

Merged
merged 5 commits into from
Sep 11, 2024
Merged

feat: Zero Runtime mode #261

merged 5 commits into from
Sep 11, 2024

Conversation

harlan-zw
Copy link
Collaborator

@harlan-zw harlan-zw commented Sep 11, 2024

πŸ”— Linked issue

#210

#162 (workaround)
#193 (workaround)

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ 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 πŸ€”

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

⚠️ 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.

@harlan-zw harlan-zw merged commit 145221a into main Sep 11, 2024
1 check failed
@harlan-zw harlan-zw deleted the feat/zero-runtime branch September 11, 2024 04:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant