babel / babel/minify

inline-environment-variables should take an object to supplement process.env

Open
#360 0 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
4.4k
Forks
217
PR merge metrics
No merged PRs in 30d

Description

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](https://github.com/hughsk/envify#module-usage) 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?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.