Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

AEM SPA - determine .env file at build time


Level 2
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?
0 Replies