26 lines
909 B
JavaScript
26 lines
909 B
JavaScript
import { readFileSync } from "fs";
|
|
import bunextInit from "../../functions/bunext-init";
|
|
import startServer from "../../functions/server/start-server";
|
|
import grabDirNames from "../../utils/grab-dir-names";
|
|
import { log } from "../../utils/log";
|
|
const { BUNDLER_CTX_MAP_JSON, SSR_BUNDLER_CTX_MAP_JSON } = grabDirNames();
|
|
log.info("Starting production server ...");
|
|
try {
|
|
const bundler_ctx_json = JSON.parse(readFileSync(BUNDLER_CTX_MAP_JSON, "utf-8"));
|
|
if (bundler_ctx_json) {
|
|
global.BUNEXT_BUNDLER_CTX_MAP = bundler_ctx_json;
|
|
}
|
|
}
|
|
catch (error) {
|
|
// log.error(`Couldn't set global bundler CTX map: ${error.message}`);
|
|
}
|
|
try {
|
|
const ssr_bundler_ctx_json = JSON.parse(readFileSync(SSR_BUNDLER_CTX_MAP_JSON, "utf-8"));
|
|
if (ssr_bundler_ctx_json) {
|
|
global.BUNEXT_SSR_BUNDLER_CTX_MAP = ssr_bundler_ctx_json;
|
|
}
|
|
}
|
|
catch (error) { }
|
|
await bunextInit();
|
|
await startServer();
|