Skip to content

Commit a6c290b

Browse files
authored
Merge pull request #151 from sanderploegsma/master
fix: start server when serving static functions
2 parents c23bd15 + 3fd8234 commit a6c290b

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

bin/cmd.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,18 @@ program
3030
.action(function(cmd, options) {
3131
console.log("netlify-lambda: Starting server");
3232
var static = Boolean(program.static);
33-
if (static) return; // early terminate, don't build
3433
var server;
34+
var startServer = function() {
35+
server = serve.listen(
36+
program.port || 9000,
37+
static,
38+
Number(program.timeout) || 10
39+
);
40+
}
41+
if (static) {
42+
startServer();
43+
return; // early terminate, don't build
44+
};
3545
build.watch(cmd, program.config, function(err, stats) {
3646
if (err) {
3747
console.error(err);
@@ -40,11 +50,7 @@ program
4050

4151
console.log(stats.toString({ color: true }));
4252
if (!server) {
43-
server = serve.listen(
44-
program.port || 9000,
45-
static,
46-
Number(program.timeout) || 10
47-
);
53+
startServer();
4854
}
4955
stats.compilation.chunks.forEach(function(chunk) {
5056
server.clearCache(chunk.name);

0 commit comments

Comments
 (0)