Skip to content

gatsby build forces NODE_ENV=production regardless of externally setting #31802

Answered by LekoArts
jonmadison asked this question in Help

You must be logged in to vote

Hi!

We won't change the behavior you're seeing. If you want to use .env.development also for production builds you'll need to use another env var to choose, e.g.

// gatsby-config.js

const activeEnv = process.env.ACTIVE_ENV || process.env.NODE_ENV

require('dotenv').config({ path: `.env.${activeEnv}` })

And then for a local:build script you'd use: ACTIVE_ENV=development gatsby build

Replies: 2 comments 3 replies

You must be logged in to vote
3 replies
@jonmadison

@Nowaker

@jonmadison-amzn

Answer selected by jonmadison

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
5 participants
Converted from issue

This discussion was converted from issue #31776 on June 07, 2021 08:06.