Typically front-end applications have particular configuration, depending on environment. It could be access tokens, API URL’s, applications settings etc. For quite long period of time I solved that problem by exposing
window.env variable, populated either by server rendering or by plugins as
html-build .. or just directly referencing
<script src="config/my.env.js">, where
my.env.js needed to be updated before actual deployment.
Spending much time on backend and working with Node.js/CommonJS I liked simplicity of
config pattern and wanted to reuse that pattern on frontend. It’s really straightforward and framework-agnostic approach.