c12
c12 copied to clipboard
Allow overridng extends with env
Related to #16
Allow adding extends with {NAME}_EXTENDS. (It is differently handled from #16 since should happen before config resolution)
Notes:
- We might allow splitting with
,for multiple values - It is limited to source without options (https://github.com/unjs/c12/issues/9)
- ~~We need to find a convention to override instead of adding to other extends values~~ (multiple extend keys can be used for overriding)
Regarding #9 I don't see a use case so far.
For the convention to override, I believe NUXT_EXTENDS is a special case since it is a special feature: https://github.com/unjs/c12#extending-configuration
We might need to pass an additional param to extend config for overriding top level extends with possible env. I agree it makes sense for some usecases (replacing layer with a development version) but also is tricky specially with #9. Imagine we need to pass some options such as license key or theme options to a layer but extending it's source to a local one.
@Atinux With introduction of env configs, do you still have usecases for this env?
Not much, actually I leverage a .env with:
MY_THEME/my/theme/path
And use:
extends: process.env.MY_THEME || 'my-theme'
So can be closed IMO
(pr welcome or feel free to directly add this as an example to the docs)