diff --git a/apps/desktop/scripts/assert-dist-built.mjs b/apps/desktop/scripts/assert-dist-built.mjs index e089ec73e7..63d838d0d8 100644 --- a/apps/desktop/scripts/assert-dist-built.mjs +++ b/apps/desktop/scripts/assert-dist-built.mjs @@ -12,6 +12,7 @@ // See issues #39484 (renderer blank page) and #41327 / #39472 (dashboard 404). import { existsSync, readFileSync, statSync, readdirSync } from "fs" +import { spawnSync } from "child_process" import { join, resolve } from "path" import { isMain } from "./utils.mjs" @@ -77,6 +78,52 @@ export function checkDistBuilt(distDir) { } } + // Parse-validate every emitted chunk as an ES module. Corrupted-silent-fail + // bundles (a dropped identifier token mid-file) produce invalid syntax that + // only explodes at module-evaluation time in Electron's renderer. + const chunkParse = verifyChunksParse(assetsDir) + if (!chunkParse.ok) { + return chunkParse + } + + return { ok: true } +} + +// Renderer chunks are emitted as ESM (`