Update init function

This commit is contained in:
Benjamin Toby 2026-04-04 19:35:14 +01:00
parent 7dbd1f7e12
commit 48c25d2fb4
9 changed files with 15 additions and 20 deletions

View File

@ -20,10 +20,6 @@ export default function () {
} }
catch (error) { } catch (error) { }
await bunextInit(); await bunextInit();
// await allPagesBunBundler();
await allPagesESBuildContextBundler({
post_build_fn: serverPostBuildFn,
});
await startServer(); await startServer();
}); });
} }

View File

@ -2,8 +2,6 @@ import { Command } from "commander";
import startServer from "../../functions/server/start-server"; import startServer from "../../functions/server/start-server";
import { log } from "../../utils/log"; import { log } from "../../utils/log";
import bunextInit from "../../functions/bunext-init"; import bunextInit from "../../functions/bunext-init";
import allPagesBunBundler from "../../functions/bundler/all-pages-bun-bundler";
import allPagesESBuildContextBundler from "../../functions/bundler/all-pages-esbuild-context-bundler";
export default function () { export default function () {
return new Command("start") return new Command("start")
.description("Start production server") .description("Start production server")
@ -11,8 +9,6 @@ export default function () {
process.env.NODE_ENV = "production"; process.env.NODE_ENV = "production";
log.info("Starting production server ..."); log.info("Starting production server ...");
await bunextInit(); await bunextInit();
// await allPagesBunBundler();
await allPagesESBuildContextBundler();
await startServer(); await startServer();
}); });
} }

View File

@ -50,6 +50,7 @@ export default async function allPagesESBuildContextBundler(params) {
], ],
jsx: "automatic", jsx: "automatic",
splitting: true, splitting: true,
treeShaking: true,
logLevel: "silent", logLevel: "silent",
// logLevel: "silent", // logLevel: "silent",
// logLevel: dev ? "error" : "silent", // logLevel: dev ? "error" : "silent",

View File

@ -5,6 +5,8 @@ import isDevelopment from "../utils/is-development";
import { log } from "../utils/log"; import { log } from "../utils/log";
import cron from "./server/cron"; import cron from "./server/cron";
import watcherEsbuildCTX from "./server/watcher-esbuild-ctx"; import watcherEsbuildCTX from "./server/watcher-esbuild-ctx";
import allPagesESBuildContextBundler from "./bundler/all-pages-esbuild-context-bundler";
import serverPostBuildFn from "./server/server-post-build-fn";
const dirNames = grabDirNames(); const dirNames = grabDirNames();
const { PAGES_DIR } = dirNames; const { PAGES_DIR } = dirNames;
export default async function bunextInit() { export default async function bunextInit() {
@ -23,9 +25,13 @@ export default async function bunextInit() {
global.ROUTER = router; global.ROUTER = router;
const is_dev = isDevelopment(); const is_dev = isDevelopment();
if (is_dev) { if (is_dev) {
await allPagesESBuildContextBundler({
post_build_fn: serverPostBuildFn,
});
watcherEsbuildCTX(); watcherEsbuildCTX();
} }
else { else {
await allPagesESBuildContextBundler();
cron(); cron();
} }
} }

View File

@ -2,7 +2,7 @@
"name": "@moduletrace/bunext", "name": "@moduletrace/bunext",
"module": "index.ts", "module": "index.ts",
"type": "module", "type": "module",
"version": "1.0.44", "version": "1.0.45",
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",
"exports": { "exports": {

View File

@ -25,12 +25,6 @@ export default function () {
await bunextInit(); await bunextInit();
// await allPagesBunBundler();
await allPagesESBuildContextBundler({
post_build_fn: serverPostBuildFn,
});
await startServer(); await startServer();
}); });
} }

View File

@ -2,8 +2,6 @@ import { Command } from "commander";
import startServer from "../../functions/server/start-server"; import startServer from "../../functions/server/start-server";
import { log } from "../../utils/log"; import { log } from "../../utils/log";
import bunextInit from "../../functions/bunext-init"; import bunextInit from "../../functions/bunext-init";
import allPagesBunBundler from "../../functions/bundler/all-pages-bun-bundler";
import allPagesESBuildContextBundler from "../../functions/bundler/all-pages-esbuild-context-bundler";
export default function () { export default function () {
return new Command("start") return new Command("start")
@ -14,9 +12,6 @@ export default function () {
await bunextInit(); await bunextInit();
// await allPagesBunBundler();
await allPagesESBuildContextBundler();
await startServer(); await startServer();
}); });
} }

View File

@ -73,6 +73,7 @@ export default async function allPagesESBuildContextBundler(params?: Params) {
], ],
jsx: "automatic", jsx: "automatic",
splitting: true, splitting: true,
treeShaking: true,
logLevel: "silent", logLevel: "silent",
// logLevel: "silent", // logLevel: "silent",
// logLevel: dev ? "error" : "silent", // logLevel: dev ? "error" : "silent",

View File

@ -13,6 +13,8 @@ import { log } from "../utils/log";
import cron from "./server/cron"; import cron from "./server/cron";
import type { BuildContext } from "esbuild"; import type { BuildContext } from "esbuild";
import watcherEsbuildCTX from "./server/watcher-esbuild-ctx"; import watcherEsbuildCTX from "./server/watcher-esbuild-ctx";
import allPagesESBuildContextBundler from "./bundler/all-pages-esbuild-context-bundler";
import serverPostBuildFn from "./server/server-post-build-fn";
/** /**
* # Declare Global Variables * # Declare Global Variables
@ -60,8 +62,12 @@ export default async function bunextInit() {
const is_dev = isDevelopment(); const is_dev = isDevelopment();
if (is_dev) { if (is_dev) {
await allPagesESBuildContextBundler({
post_build_fn: serverPostBuildFn,
});
watcherEsbuildCTX(); watcherEsbuildCTX();
} else { } else {
await allPagesESBuildContextBundler();
cron(); cron();
} }
} }