Closed cyrilf closed 2 days ago
Ok, I think that digging in the code is a good way of finding an answer :wink: So I think that the answer lies somewhere in this file or this one
So both NUXT_SITE_
and NUXT_PUBLIC_SITE_
are supported in the .env
. Do you recommend one of them?
The runtimeConfig in nuxt.config.ts
is mentioned as legacy though..
Hi, this is a good question (sorry for the delay).
The number of ways you can configure site config is a relic of how previous module version majors wanted this config. I realize it's confusing and there are too many options.
The recommendation is not to use runtimeConfig, either use site.*
, env keys without public NUXT_SITE_
or use the hooks. But it's honestly up to you, whatever works for your site is the recommendation.
I've tried to clean up the doc related to this so will close for now as not too sure what else I can do without further breaking changes.
Details
:one: Various
.env
variables names in the docOn the site config Getting started page, in the
Site Config Quick Setup
block it mentions that we can use the following keys in the.env
file:But if I open the guide setting site config / Environment specific site config (which I need, because I have local, preprod and prod environments) it says:
which is not the same keys.
So I'm wondering which one is the most recommended?
:two: Runtime config mapping to .env
On the Nuxt runtime config documentation they explicitly say that something like that in the
.env
:will match this in the
nuxt.config.ts
file:so I'm wondering why your example refers to:
for
shouldn't it be that instead:
Thanks a lot for the clarifications! :ok_hand: