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

support zero-runtime when prerendering #210

Open
danielroe opened this issue May 13, 2024 · 3 comments
Open

support zero-runtime when prerendering #210

danielroe opened this issue May 13, 2024 · 3 comments

Comments

@danielroe
Copy link
Contributor

When fully prerendering all static pages, it would be nice to support a mode where there is no server footprint.

For example, in this PR, nuxt-og-image adds some overhead (200kB+ to server runtime, and 1.2Mb+ to node_modules) which ideally I would like to avoid - as in my case I know it is not needed once the pages are prerendered.

@harlan-zw
Copy link
Collaborator

harlan-zw commented May 14, 2024

This is technically supported already but the DX isn't great and docs are missing.

This is what is used internally when stripping the dependencies:

export default defineNuxtConfig({
  ogImage: {
    compatibility: {
       runtime: {
         'chromium': false,
         'satori': false,
         'css-inline': false,
         'resvg': false,
         'sharp': false,
       }
    }
  }
})

This is less verbose and may also work too (it's a bug if it doesn't):

export default defineNuxtConfig({
  ogImage: {
    compatibility: {
       runtime: {
         satori: false,
       }
    }
  }
})

I'll leave this issue open to document it properly.
It would be nice to support a zero-config option for this but seems like it could cause some issues 🤔

@danielroe
Copy link
Contributor Author

I think I tried that in the linked PR but it is not sufficient due to other runtime code that is added, such as for nuxt-site-config, a Nuxt content integration, and possibly other plugins.

@harlan-zw
Copy link
Collaborator

I'd like to support this but it's partially blocked by Nuxt Kit tooling.

Ideally, we'd be able to register routes or plugins that only register during prerender.

It can be solved but will require migrating to dynamic templates that noop out for non-prerender environments, I'd like to avoid adding this complexity to the templates at this time.

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

No branches or pull requests

2 participants