Skip to content

Commit

Permalink
Merge pull request #151 from sanderploegsma/master
Browse files Browse the repository at this point in the history
fix: start server when serving static functions
  • Loading branch information
swyxio authored May 16, 2019
2 parents c23bd15 + 3fd8234 commit a6c290b
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions bin/cmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,18 @@ program
.action(function(cmd, options) {
console.log("netlify-lambda: Starting server");
var static = Boolean(program.static);
if (static) return; // early terminate, don't build
var server;
var startServer = function() {
server = serve.listen(
program.port || 9000,
static,
Number(program.timeout) || 10
);
}
if (static) {
startServer();
return; // early terminate, don't build
};
build.watch(cmd, program.config, function(err, stats) {
if (err) {
console.error(err);
Expand All @@ -40,11 +50,7 @@ program

console.log(stats.toString({ color: true }));
if (!server) {
server = serve.listen(
program.port || 9000,
static,
Number(program.timeout) || 10
);
startServer();
}
stats.compilation.chunks.forEach(function(chunk) {
server.clearCache(chunk.name);
Expand Down

0 comments on commit a6c290b

Please sign in to comment.