How to store environment-specific configuration used in Javascript code?

With webpack that would be accomplished with something like

See also: Should I move from brunch to webpack? - #14 by peerreynders

I’m using Brunch and Babel (added by the framework).

I assume that “the framework” refers to Phoenix.

Description how to use webpack 4 (with Phoenix 1.3.x) instead of brunch:

alternate

That being said recommended practice is to limit the reliance on environment variables to one, single variable typically process.env.NODE_ENV - which is then used to select the correct module (e.g. settings.prod.js vs. settings.dev.js) to include in the generated JS bundle.

SurviveJS: Choosing which module to use


A similar approach seems to be possible with brunch with the jsenv-brunch plugin (npm).