I have searched through this slack channel and the...
# help
d
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
REACT_APP_
. The frontend is using a React site, but it was not created with
create-react-app
. I have added
@serverless-stack/static-site-env
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
REACT_APP_
environment variables have values in the frontend project. Is this because I am not using
create-react-app
? If so, is there a way I can get these values passed to the frontend?
f
Hey @Derek Curtis,
REACT_APP_
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
REACT_APP_*
. For Next.js it’s
NEXT_PUBLIC_*
. You’d need to find out what that is for the framework u r using.
d
The frontend is using React.js, but not CRA.