Gjorgji Kjosev
12/24/2021, 12:09 AMsst.ReactStaticSite
allow environment variables to be passed to the frontend app? Does it depend on a particular setup for production deployment? (i.e. availability of scripts, webpack env variable / define plugin, etcFrank
new ReactStaticSite(this, "ReactSite", {
path: "path/to/src",
environment: {
REACT_APP_API_URL: api.url,
},
});
1. At build time, SST build runs REACT_APP_API_URL="{{ REACT_APP_API_URL }}" npm run build
2. After api
is deployed, {{ REACT_APP_API_URL }}
is replaced with the deployed value in all .html and .js filesGjorgji Kjosev
12/24/2021, 9:56 AMbuild
script that takes advantage of environment variables should work.Gjorgji Kjosev
12/24/2021, 9:56 AMFrank