Skip to content

Conversation

@KyleAMathews
Copy link
Contributor

Fixes #337

There seems to be a few Webpack loaders that require this e.g.
sass-loader. We set NODE_ENV to production already inside Webpack e.g.
for React's optimizations but this PR is necessary for code outside
Webpack e.g. node code in Webpack loaders.

Fixes #337

There seems to be a few Webpack loaders that require this e.g.
sass-loader. We set NODE_ENV to production already *inside* Webpack e.g.
for React's optimizations but this PR is necessary for code *outside*
Webpack e.g. node code in Webpack loaders.
@KyleAMathews KyleAMathews merged commit 7b410f1 into master Jul 6, 2016
@oliverbenns
Copy link
Contributor

oliverbenns commented Dec 24, 2016

Would love to be able to set my own NODE_ENV, e.g. NODE_ENV=version1 gatsby build.

@KyleAMathews
Copy link
Contributor Author

@oliverbenns you generally don't want to override NODE_ENV as it has specific meaning e.g. many modules including React itself look at NODE_ENV to see if it is set to production to see if they should apply optimizations e.g. turning off dev checks. If you override that, your site will become significantly slower.

Want you want to do probably is use a different environment variable e.g. BUILD_VERSION=1 and then use the same technique as Gatsby core uses to make that env variable available to your frontend code

'process.env': {

@0x80 0x80 deleted the set-production branch April 19, 2017 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants