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

Does not support async Nuxt config at runtime #622

Open
danielroe opened this issue Sep 8, 2021 · 5 comments
Open

Does not support async Nuxt config at runtime #622

danielroe opened this issue Sep 8, 2021 · 5 comments

Comments

@danielroe
Copy link
Member

danielroe commented Sep 8, 2021

This module supports async nuxt config when building the lambda, but an async function which returns a config at runtime is not supported in this builder. (In general this would be an anti-pattern for a serverless function.)

This issue is to collect the use cases for an async function.

@lukas-a-brand
Copy link

@danielroe yup sure.

In general my requirements are that I need some async requests for loading configuration, (app config, styling config for tailwind, and other modules, ... ) from a cms ( axios request ). In addition to that also some other axios requests for sitemap information, etc.

So a lot of stuff that I would need before I can export the nuxt.config. :)

Is there still a way to go with Vercel SSR and the builder ? :)

@danielroe
Copy link
Member Author

@lukas-a-brand Do you need to do that per-request or only on the initial build?

@lukas-a-brand
Copy link

lukas-a-brand commented Sep 8, 2021

@danielroe certainly only initially, per build.

@danielroe
Copy link
Member Author

@lukas-a-brand I'd certainly recommend a buildModule that fetches your configuration and then injects all the other build modules with the correct configuration, as well as modifying any other nuxt options. You will find it hugely improves your cold start performance.

@lukas-a-brand
Copy link

@danielroe oh, I see, so with the build module async operations and data fetching / conversions are no problem, and also giving the data fetched to other modules in the nuxt config ? (https://nuxtjs.org/docs/2.x/directory-structure/modules#async-modules <-- I guess ? ) How can I then as best practice share the data with the rest of the nuxt.config.js ? )

Also another use case:
Is there also a possibility to prefill the nuxt store with data in a build module by any chance ? ( or with a normal module, because this data could very well change during the applicaiton lifetime )

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