DEV Community

Discussion on: How to dynamically change your React Environment variables without re-building

Collapse
 
adrianfleming profile image
AdrianFleming

Thanks for this, I've always used Webpack externals and have been tasked with finding an elegant solution to injecting variables at runtime, and this is better than creating an endpoint to return the variables or loading a Json file. I have a question though; my app was using cache busting in Webpack but the npx script creates a new env.js in this case. I've switched cache busting off for now but is there any way the script can pick up the cache busting file, in my case env.5df60b24c6fb4378557c.js?

Collapse
 
eslynn profile image
lynn • Edited

Hey! I'm not familiar with cache-busting on webpack as I typically use CRA. Do you think you could provide a sample?