React — execute code only during build time (version / timestamp)

A method to execute a piece of code only during build time.

Do you want to include a segment of code that should only be executed during build time of a Create React App (CRA) environment? For instance, version control or even timestamp which the CRA is bundled.

In this article, I will refer to external libraries — preval.macro.