Merge branch 'expose-bundler'

main
f0x 2 years ago
commit 7b8d75b1a1

@ -37,7 +37,7 @@ module.exports = function budoExpress(options = {}) {
};
if (process.env.BUDO_BUILD === "1") {
bundle(context);
return bundle(context);
} else {
let productionHost = defaultValue(options.host, "::");
let developmentHost = (options.allowUnsafeHost) ? productionHost : "127.0.0.1";
@ -46,12 +46,12 @@ module.exports = function budoExpress(options = {}) {
let developmentMode = getDevelopmentMode(developmentModeSetting);
if (developmentMode) {
developmentServer({
return developmentServer({
... context,
host: developmentHost
});
} else {
productionServer({
return productionServer({
... context,
host: productionHost
});

@ -24,7 +24,7 @@ module.exports = function bundle({ options, staticPath, entryPaths }) {
return Promise.try(() => {
return mkdirAsync(targetFolder, { recursive: true });
}).then(() => {
browserifyInstance
return browserifyInstance
.bundle()
.pipe(fs.createWriteStream(targetBundlePath))
.on("finish", () => {

@ -90,4 +90,5 @@ module.exports = function ({ options, staticPath, staticBasePath, entryPaths, ho
devServer.reload("*");
});
});
return devServer;
};

@ -1,7 +1,7 @@
"use strict";
module.exports = function productionServer({ options, host }) {
options.expressApp
return options.expressApp
.listen({ port: options.port, host: host })
.on("listening", (_event) => {
console.log(`Production server running on ${(host === "::") ? "*" : host}:${options.port}`);

Loading…
Cancel
Save