Can't access gatsby environment variables on the client side

前端 未结 5 1168
旧时难觅i
旧时难觅i 2021-02-19 00:44

I set up .env file and gatsby-config.js as below.

// .env.development
GATSBY_API_URL=https://example.com/api
         


        
5条回答
  •  醉话见心
    2021-02-19 01:19

    you may add your env key to the allow list in gatsby-config.js

    { 
      resolve: `gatsby-plugin-env-variables`,
        options: {
          allowList: [
            "XXXXXXXXX", 
          ]
        }
    }
    

提交回复
热议问题