Good article about a very common problem.
Blake Janelle

Blake Janelle thanks for comment. The 4th option might be a bit confusing to explain. I will try to clarify few points about it.

I do not minify/concat/uglify the constant service as it’s only few lines of code (I run it for everything apart from the constant service). As for having the same build artifacts, you should get exactly the same artifacts no matter what environment you build for (with option 4), that means that you can promote your staging to prod, etc. I think of constant service more like a server side template file, like ruby .erb or mustache templates and node injects correct env variables before sending it.

I hope that clarifies a bit option 4.

Show your support

Clapping shows how much you appreciated Vitalij Kudresov’s story.