AEM SPA - determine .env file at build time

Avatar

Avatar

phychem_ad

Avatar

phychem_ad

phychem_ad

25-10-2020

The issue is related to the SPA React package at build time. We used the aem-project-archetype as the starting point. It included a ".env" file in the ui.frontend folder to specify the environment variables for the React app. The ".env" file is used to inject the environment variables to the React app when the project is built (mvn clean install -PautoInstallPackage --> npm run build).
 
I have searched this forum and found that some people pull the runmode via some hidden html but this is not a desirable approach as the .env used in the project archetype injects the variables within the app at build time but not runtime.
 
Are we able to obtain the runmode osgi configuration at project build time?  If this is not feasible, what is the recommended way to setup environment variables for the frontend app in an AEM SPA project?

Accepted Solutions (0)

Answers (0)