Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions lib/serve.js
Original file line number Diff line number Diff line change
@@ -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