I have searched through this slack channel and the...
# help
I have searched through this slack channel and the site to see if anyone else has had the issue I am experiencing and I cannot find anything similar so here goes.... I have a frontend stack that uses ReactStaticSite and I pass 14 environment variables. They are all prefixed with
. The frontend is using a React site, but it was not created with
. I have added
to the frontend project and I have added
sst-env --
to the start command. I run
npx sst start --profile sandbox --stage sandbox
on my root project and then run
npm run start
in my frontend project. None of the
environment variables have values in the frontend project. Is this because I am not using
? If so, is there a way I can get these values passed to the frontend?
Hey @Derek Curtis,
is specific to CRA https://create-react-app.dev/docs/adding-custom-environment-variables/
For most frontend frameworks, they don’t expose environment variables to JS, except for certain predefined format. For CRA, it’s
. For Next.js it’s
. You’d need to find out what that is for the framework u r using.
The frontend is using React.js, but not CRA.