For all of our gatsby.js projects, we are using at least 3 environments, and the typescript.
Is there a way to use unique set of plugins, or even different gatsby.config/node/ssr js depending on ENV variable?
You can add/remove plugins and node/SSR code depending on the environment as it's all JavaScript.
You can access env variables at process.env.MYVAR
@JustFly1984 we have an env variable just for that called GATSBY_ACTIVE_ENV (more info: https://www.gatsbyjs.org/docs/environment-variables/#additional-environments-staging-test-etc). It will still put NODE_ENV=production when running gatsby build so your site is minfied and everything but it will read different .env files from disk. You can also use it directly in code as @KyleAMathews described.
does this make sense?
Hiya!
This issue has gone quiet. Spooky quiet. 馃懟
We get a lot of issues, so we currently close issues after 30 days of inactivity. It鈥檚 been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contributefor more information about opening PRs, triaging issues, and contributing!
Thanks for being a part of the Gatsby community! 馃挭馃挏
Hey again!
It鈥檚 been 30 days since anything happened on this issue, so our friendly neighborhood robot (that鈥檚 me!) is going to close it.
Please keep in mind that I鈥檓 only a robot, so if I鈥檝e closed this issue in error, I鈥檓 HUMAN_EMOTION_SORRY. Please feel free to reopen this issue or create a new one if you need anything else.
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!
Thanks again for being part of the Gatsby community!
In addition to the question of the author, is it also possible to run a build version using a staging .env file?
Most helpful comment
In addition to the question of the author, is it also possible to run a build version using a staging .env file?