Closed ajmueller closed 4 years ago
Hi, thanks for submitting your issue.
I believe that is solution of using GATSBY_
is the better, such as recommended by the official documentation.
About the problem relates to import the gatsby-config.js
: according to the documentation, it's necessary to import dotenv package to use the environment variables, but, when we import the config file in editor.js (client side), we have an error, like you report.
So, you can use the environment variables from your shell or before to run the develop
or build
command, like this section describes.
I was following your tutorial, but made a modification to
gatsby-config.js
: I used an environment variable to define my Storyblok token. When running thedevelop
command, I get the following error:This is due to line 4 in
pages/editor.js
that imports thegatsby-config.js
file. It seems that the simplest solution may be to always use an environment variable for the token and ensure it's prefixed withGATSBY_
to make it available to the client side code. I'm happy to prepare a PR for this if that approach is okay with you.