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

Prawira G.
1 min readJun 2, 2020

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

PROBLEM

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.

--

--

Prawira G.

Full Stack TypeScript | Blockchain Enthusiast | OAUTH2.0 & OIDC | Software Engineer.