fix(ui): lazy-load the offline word-check helper to keep it out of the entry bundle
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Has been skipped
CI / integration (pull_request) Has been skipped
CI / ui (pull_request) Successful in 1m14s
CI / conformance (pull_request) Successful in 11s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 2m42s

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.
This commit is contained in:
Ilia Denisov
2026-07-14 08:59:41 +02:00
parent 28afcff551
commit c522e77599
+3 -1
View File
@@ -3,7 +3,6 @@
import { gateway } from '../lib/gateway'; import { gateway } from '../lib/gateway';
import { gameSource, isLocalGameId } from '../lib/gamesource'; import { gameSource, isLocalGameId } from '../lib/gamesource';
import { connection } from '../lib/connection.svelte'; import { connection } from '../lib/connection.svelte';
import { localWordCheck } from '../lib/dict/check';
import { handleError, showToast } from '../lib/app.svelte'; import { handleError, showToast } from '../lib/app.svelte';
import { t } from '../lib/i18n/index.svelte'; import { t } from '../lib/i18n/index.svelte';
import { alphabetLetters } from '../lib/alphabet'; import { alphabetLetters } from '../lib/alphabet';
@@ -57,6 +56,9 @@
// pinned dictionary read on-device: exact when that dawg is cached/bundled, otherwise the check // 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. // is unavailable. A local game already resolves checkWord on-device, so it keeps that path.
if (!isLocalGameId(id) && !connection.online) { 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); const legal = await localWordCheck(variant, dictVersion, w);
if (legal === null) { if (legal === null) {
result = null; result = null;