Skip to content

Commit

Permalink
try to use hapi if electrodeServer is not found (#1521)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcaowml authored Feb 3, 2020
1 parent e39afa7 commit 1bdbc0b
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const ck = require("chalker");
const archetype = require("electrode-archetype-react-app/config/archetype");
const optionalRequire = require("optional-require")(require);
const electrodeServer = optionalRequire("electrode-server");
const Hapi = optionalRequire("@hapi/hapi");
const Koa = optionalRequire("koa");
const express = optionalRequire("express");

Expand Down Expand Up @@ -35,6 +36,21 @@ if (electrodeServer) {
}
}
});
} else if (Hapi) {
const app = Hapi.server({
port: archetype.webpack.devPort,
host: archetype.webpack.devHostname
});
app.register(require("./dev-hapi"))
.then(() => app.start())
.then(() => {
console.log(
ck`<green>Hapi webpack dev server listening on port ${archetype.webpack.devPort}</>`
);
})
.catch(err => {
console.error(ck`<red>koa webpack dev server failed</>${err}`);
});
} else if (Koa) {
const app = new Koa();
const setup = require("./dev-koa");
Expand Down

0 comments on commit 1bdbc0b

Please sign in to comment.