Is Parcel using dotenv as it claims, or dotenv-flow? It links to dotenv but supports multiple env files in the same manner as dotenv-flow, which is not included behavior with dotenv and actively warns against it. However dotenv-flow has specific rules on which env files have higher precedence. Command line env variables have the highest precedence, and .env.local is still loaded for test. This is the behavior that next.js and create react app uses.
I think parcel needs to go with one or the other, link to it, and use the same logic. If not remove the link and just document it's own rules : What files can be source controlled? What files overwrite others? Are command line env variables overwritten if defined etc.
Also what is the rationale behind not using .env.local for test? Env variables loaded via jenkins/aws/etc are higher priority than ones defined in env files with dotenv-flow. .env.local will have unsourced secrets and may need to be different than the actual test environment (dev/qa/staging etc), but API keys may still be necessary for any integration or end-to-end testing. Precedence order should make sure it all works correctly which is the main concern when using multiple .env files. I'd probably end up with two local env files with the same configuration and I'm not sure I'm understanding what the benefit is.
Is Parcel using dotenv as it claims, or dotenv-flow? It links to
dotenvbut supports multiple env files in the same manner asdotenv-flow, which is not included behavior withdotenvand actively warns against it. Howeverdotenv-flowhas specific rules on which env files have higher precedence. Command line env variables have the highest precedence, and.env.localis still loaded for test. This is the behavior that next.js and create react app uses.I think parcel needs to go with one or the other, link to it, and use the same logic. If not remove the link and just document it's own rules : What files can be source controlled? What files overwrite others? Are command line env variables overwritten if defined etc.
Also what is the rationale behind not using
.env.localfor test? Env variables loaded via jenkins/aws/etc are higher priority than ones defined in env files withdotenv-flow..env.localwill have unsourced secrets and may need to be different than the actual test environment (dev/qa/staging etc), but API keys may still be necessary for any integration or end-to-end testing. Precedence order should make sure it all works correctly which is the main concern when using multiple.envfiles. I'd probably end up with two local env files with the same configuration and I'm not sure I'm understanding what the benefit is.