gatsby build forces NODE_ENV=production regardless of externally setting #31802
-
Well perhaps not force it during development. Just set it unless the user set something else. We have to have Originally posted by @KyleAMathews in #3896 (comment) it seems like you do force it in gatsby build. trying to do a development build (in order to build my elasticsearch index locally and take advantage of pointing to my local elastic search URL via in my gatsby-config:
after running
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Hi! We won't change the behavior you're seeing. If you want to use // gatsby-config.js
const activeEnv = process.env.ACTIVE_ENV || process.env.NODE_ENV
require('dotenv').config({ path: `.env.${activeEnv}` }) And then for a |
Beta Was this translation helpful? Give feedback.
-
How'll this work in this case https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-source-wordpress/docs/plugin-options.md#develophardcachemediafiles I want to cache wordpress-calls (since I have ~30k pages), and everytime I build again and again I have to fetch those many pages. How difficult was for you guys to do just process.env.NODE_ENV = process.env.NODE_ENV || "production" imo, just another dump decision enforced to users by the framework. Gatsby never was meant for large scale sites. |
Beta Was this translation helpful? Give feedback.
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.And then for a
local:build
script you'd use:ACTIVE_ENV=development gatsby build