build: enable frontend module code splitting

This commit is contained in:
sjg
2026-08-01 14:40:59 +02:00
parent 1a42d58075
commit 26be675242
25 changed files with 8931 additions and 9455 deletions
@@ -0,0 +1,19 @@
// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
//
// SPDX-License-Identifier: GPL-2.0-or-later
import { build } from "esbuild";
export async function bundleEntry(entryUrl) {
const result = await build({
entryPoints: [entryUrl.pathname],
bundle: true,
format: "iife",
platform: "browser",
target: "es2022",
write: false,
});
const output = result.outputFiles[0];
if (!output) throw new Error(`No bundle output for ${entryUrl.pathname}`);
return output.text;
}