From c522e77599b714f9cd390e9e6e1da341ddcbb6cb Mon Sep 17 00:00:00 2001 From: Ilia Denisov Date: Tue, 14 Jul 2026 08:59:41 +0200 Subject: [PATCH] fix(ui): lazy-load the offline word-check helper to keep it out of the entry bundle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CheckScreen's static import of dict/check pulled the dawg loader/reader into the app entry bundle, pushing it 0.8 KB over the 130 KB budget (CI bundle-size gate). The dict subsystem is lazy everywhere else, so import localWordCheck dynamically in the offline branch — it loads only when an offline check actually runs. Main entry back to 129.0 KB. --- ui/src/game/CheckScreen.svelte | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui/src/game/CheckScreen.svelte b/ui/src/game/CheckScreen.svelte index c07aff5..e1b2211 100644 --- a/ui/src/game/CheckScreen.svelte +++ b/ui/src/game/CheckScreen.svelte @@ -3,7 +3,6 @@ import { gateway } from '../lib/gateway'; import { gameSource, isLocalGameId } from '../lib/gamesource'; import { connection } from '../lib/connection.svelte'; - import { localWordCheck } from '../lib/dict/check'; import { handleError, showToast } from '../lib/app.svelte'; import { t } from '../lib/i18n/index.svelte'; import { alphabetLetters } from '../lib/alphabet'; @@ -57,6 +56,9 @@ // pinned dictionary read on-device: exact when that dawg is cached/bundled, otherwise the check // is unavailable. A local game already resolves checkWord on-device, so it keeps that path. if (!isLocalGameId(id) && !connection.online) { + // Dynamically imported so the dawg reader/loader stays out of the app entry bundle (the dict + // subsystem is lazy everywhere else too); it loads only when an offline check actually runs. + const { localWordCheck } = await import('../lib/dict/check'); const legal = await localWordCheck(variant, dictVersion, w); if (legal === null) { result = null;