Alternatively you can rebuild the app on the server anytime you change them. To read them at runtime, you would need to load HTML into memory on the server and replace placeholders in runtime, as described here. Since Create React App produces a static HTML/CSS/JS bundle, it can’t possibly read them at runtime. The environment variables are embedded during the build time. WARNING: Do not store any secrets (such as private API keys) in your React app!Įnvironment variables are embedded into the build, meaning anyone can view them by inspecting your app's files. By default you will have NODE_ENV defined for you, and any other environment variables starting with REACT_APP_. Your project can consume variables declared in your environment as if they were declared locally in your JS files. Note: this feature is available with and higher.
0 Comments
Leave a Reply. |