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
When using process.env replacement and building for multiple environments with different configurations simultaneously, these vars will overwrite each other and only the latest will take effect, affect all current builds.
To illustrate with a use case: building the same project for multiple partners with process.env based branding tweaks. When running a "partners build" the env vars are set like Object.keys(env).forEach(key => process.env[key] = env[key]) and the last set values will affect all builds. This should be obvious, but it took us a while to realize what was happening.
Similar tools, such as envify allow for an object to be used for replacement values, in addition to process.env. Perhaps inline-environment-variables can take the same approach: allow for an object that would override process.env if it contained a matching key?
The text was updated successfully, but these errors were encountered:
When using
process.env
replacement and building for multiple environments with different configurations simultaneously, these vars will overwrite each other and only the latest will take effect, affect all current builds.To illustrate with a use case: building the same project for multiple partners with
process.env
based branding tweaks. When running a "partners build" the env vars are set likeObject.keys(env).forEach(key => process.env[key] = env[key])
and the last set values will affect all builds. This should be obvious, but it took us a while to realize what was happening.Similar tools, such as envify allow for an object to be used for replacement values, in addition to
process.env
. Perhaps inline-environment-variables can take the same approach: allow for an object that would overrideprocess.env
if it contained a matching key?The text was updated successfully, but these errors were encountered: