Closed guirak closed 3 months ago
Modules are build-time only. If you want to run something when your app starts you can use/add a nitro plugin.
OK thank you. I have found a way setting the variables in a pinia store from a plugin and using the hydration to have access to the variables in the client side.
Hello,
I have a monorepos nuxt 3 app with several custom nuxt modules.
On these modules, I have defined some environnement variables in my module.ts like :
This work well in dev but when building the app for production, the hook is called during the build phase and not at the startup of the app (node .output/server/index.mjs).
I want to integrate my app in a kubernetes pod with a config map in different environments so I need to be able to provide dynamically the environnement variables when starting the nuxt server and not during the build.
Is there a hook or another way to do this in a nuxt module ?