Environment Variables (Create-React-App) on App Platform
I’m running a aspnet core application with an SPA created using creat-react-app.
In this application I use some environment variables in the client. The official way to do this with this tool is to prefix the variables with “REACTAPP”. (https://create-react-app.dev/docs/adding-custom-environment-variables/)
I’ve created these variables in my component settings. By default these are scoped as RUNANDBUILD_TIME. But they don’t seem to be available
when my page is being built.
I added a couple of extra RUN instructions in my docker file to try and print these variables, they come out empty.
My application’s dockerfile is based on example provided here:
With the only modification being the installation of nodejs.
Thanks in advance, any help or clarification will be greatly appreciated. Hopefully I just missed something from the docs :)
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.×