From 1aa55508c450e42d92b3afb0c495962cfdab152b Mon Sep 17 00:00:00 2001 From: YUZHEthefool <2804776511@qq.com> Date: Tue, 25 Aug 2026 14:22:46 +0800 Subject: [PATCH] fix(build): disable custom codeSplitting that crashed the release bundle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A recent build config added `rolldownOptions.output.codeSplitting` with a `liveagent-app` group. That custom chunking split the `style-to-js → style-to-object → inline-style-parser` CommonJS interop chain across chunks. rolldown's `__commonJSMin` thunks then failed to initialize across the chunk boundary, so the release bundle crashed at render time with `require_cjs$N is not a function` — a black screen with an AppErrorBoundary, while `tauri dev` (no chunk splitting) worked fine. Set `codeSplitting: false` to fall back to rolldown's default automatic chunking, which keeps that CJS chain in one chunk. Verified the release exe launches and renders correctly after the change. --- crates/agent-gui/vite.config.ts | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/crates/agent-gui/vite.config.ts b/crates/agent-gui/vite.config.ts index a5e11af6c..7d011244e 100644 --- a/crates/agent-gui/vite.config.ts +++ b/crates/agent-gui/vite.config.ts @@ -30,22 +30,20 @@ export default defineConfig(async () => ({ }, build: { // Monaco language workers are emitted as indivisible lazy assets (largest - // is the TypeScript worker at ~6.6 MB). Application modules are still held - // to the 450 KB code-splitting group below. + // is the TypeScript worker at ~6.6 MB). Bump the warning limit so those + // known-large chunks don't drown out real regressions in the console. chunkSizeWarningLimit: 7_000, + // NOTE: a previous build config set `rolldownOptions.output.codeSplitting` + // with a `liveagent-app` group. That custom chunking split the + // `style-to-js → style-to-object → inline-style-parser` CommonJS interop + // chain across chunks, and rolldown's `__commonJSMin` thunks failed to + // initialize across the chunk boundary — the release bundle crashed at + // render time with "require_cjs$N is not a function" (black screen), while + // `tauri dev` (no chunk splitting) worked. Disabled here to fall back to + // rolldown's default automatic chunking, which keeps that CJS chain intact. rolldownOptions: { output: { - codeSplitting: { - minSize: 20_000, - maxSize: 450_000, - groups: [ - { - name: "liveagent-app", - test: /\/crates\/(?:agent-gui|agent-ui)\/src\//, - entriesAware: true, - }, - ], - }, + codeSplitting: false, }, }, },