Skip to content

Commit

Permalink
Set NODE_ENV env var to 'production' when building
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
KyleAMathews committed Jul 6, 2016
1 parent 39e7e71 commit 5adc5b0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ program.command('build')
.description('Build a Gatsby project.')
.option('--prefix-links', 'Build site with links prefixed (set prefix in your config).')
.action((command) => {
// Set NODE_ENV to 'production'
process.env.NODE_ENV = 'production'

const build = require('../utils/build')
const p = {
...command,
Expand Down

0 comments on commit 5adc5b0

Please sign in to comment.