add build chiunking

This commit is contained in:
tresabhi committed 2026-05-18 13:54:03 -05:00
1 parent ff3ed9d656
commit 47c87970cd
32 files changed
+16

No files matched your search

@@ -0,0 +1,6 @@
import { assertSecret } from "@blitzkit/core";
export function isChunkEnabled(chunk: string) {
const buildChunk = assertSecret(import.meta.env.BUILD_CHUNK);
return [chunk, "*"].includes(buildChunk);
}
@@ -1,6 +1,7 @@
---
import locales from "@blitzkit/i18n/locales.json";
import type { GetStaticPaths } from "astro";
import { isChunkEnabled } from "../../astro/isChunkEnabled";
import ClientUnmountedWarning from "../../components/ClientUnmountedWarning.astro";
import ColorScale from "../../components/ColorScale.astro";
import HomeCosmetics from "../../components/HomeCosmetics.astro";
@@ -14,6 +15,8 @@ import { clientUnmounted } from "../../game/unmounted";
import BaseLayout from "../../layouts/BaseLayout.astro";
export const getStaticPaths = (() => {
if (!isChunkEnabled("pages")) return [];
return [
...locales.supported
.filter(({ locale }) => locale !== locales.default)
@@ -0,0 +1,7 @@
import type { GetStaticPaths } from "astro";
import { isChunkEnabled } from "../../astro/isChunkEnabled";
export const getStaticPaths = (() => {
if (!isChunkEnabled("api")) return [];
return [{ params: { api: "api" } }];
}) satisfies GetStaticPaths;