You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Variables with the NITRO prefix defined in .env files are not replacing variables that are undefined/null in the nitro.config.ts.
This is caused by how defu handles undefined/null values in c12 (https://github.com/unjs/c12/blob/e52c54171b3546cb9ee9233e6ca95221e2a5adfd/src/loader.ts#L169).
The fix #907 didn't fix this problem, as in Nuxt, defaults are applied at a later point while in Nitro, the values are already stripped out by c12.
I think this should be fixed in c12, so if you have a preferred way for this @pi0, I will create a PR there.
We can use a custom merger for defu in c12 when defaults are applied or overwriting undefined/null before it goes to defu. This should probably be hidden behind a switch like provideFallbackValues, mergeUndefinedValues, etc. to avoid a breaking change.
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered:
A custom merger makes sense or alternatively, we can scan c12 layers (they contain original config) and collect list of known runtime config keys to scan.
Implicitly collecting build-time env values to assume as runtime config might lead to unexpected results so probably better we still require that.
Environment
Latest nitro, Node 20
Reproduction
https://stackblitz.com/edit/github-qmagwv
Describe the bug
Variables with the
NITRO
prefix defined in .env files are not replacing variables that are undefined/null in the nitro.config.ts.This is caused by how defu handles undefined/null values in c12 (https://github.com/unjs/c12/blob/e52c54171b3546cb9ee9233e6ca95221e2a5adfd/src/loader.ts#L169).
The fix #907 didn't fix this problem, as in Nuxt, defaults are applied at a later point while in Nitro, the values are already stripped out by c12.
I think this should be fixed in c12, so if you have a preferred way for this @pi0, I will create a PR there.
We can use a custom merger for defu in c12 when defaults are applied or overwriting undefined/null before it goes to defu. This should probably be hidden behind a switch like
provideFallbackValues
,mergeUndefinedValues
, etc. to avoid a breaking change.Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: