Skip to content

Commit

Permalink
Propagate NODE_ENV to other packages (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
kandros authored and leo committed Dec 17, 2017
1 parent 98c67c3 commit c29abde
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/serve.js
@@ -1,3 +1,6 @@
// Ensure that the loaded files and packages have the correct env
process.env.NODE_ENV = process.env.NODE_ENV || 'development'

// Packages
const getPort = require('get-port')
const serve = require('micro/lib')
Expand All @@ -8,16 +11,15 @@ const listening = require('./listening')
const log = require('./log')

module.exports = async (file, flags, restarting) => {
// Ensure that the loaded files have the correct env
process.env.NODE_ENV = process.env.NODE_ENV || 'development'

// Emit SIGNUSR2 to signal restart to user code
if (restarting) {
process.emit('SIGNUSR2')
}

// And then load the files
const module = flags.silent ? getModule(file) : log(getModule(file), flags.limit)
const module = flags.silent
? getModule(file)
: log(getModule(file), flags.limit)
const server = serve(module)

// `3000` is the default port
Expand Down

0 comments on commit c29abde

Please sign in to comment.