To enable /__refresh end point, I have to set ENABLE_GATSBY_REFRESH_ENDPOINT to true, but I don't know how to add environment variables to gatsby. How can I do that?
In the root of your project, you'll want to create a .env.development
file if you don't have one already and add the following:
ENABLE_GATSBY_REFRESH_ENDPOINT=true
You will also want to add that file to your project's .gitignore
, it's good practice to not commit .env
files to source control. Gatsby outlines how to use environment variables here.