Cannot extend specific environments

Author: steverepCreated Jun 4, 2024Updated Jun 5, 2024

I find the feature to extend configs pretty limiting. Not only can you not extend other local files (#408), but there is no way to extend specific environments from the shared config or from the same config. Extending from another environment in the same config could be especially useful. For example:

[legacy]
supports es5 and not dead

[legacyPlus]
extends legacy from . and supports clipboard

I'll note that a shared config can have different environments that can be selected, but the method for doing so is confusing and doesn't work unless the environment name in the local config matches that of the shared config. For example, borrowing the syntax above, you cannot do:

[legacyPlus]
extends legacy from sharedConfig and supports clipboard

I think there are several possible syntax changes that could easily add this:

  • "extends env from config", where config can be "." or another keyword to represent the current config
  • "extends value", where value could also be the name of another environment in the same config in addition to the current behavior
  • Add a new "env environment" query

My gut says the first one is best but I'd need to examine the code further.

Source: browserslist/browserslist