Skip to content
Source
Sign inSign up
pingdotgg/t3code

build(desktop): reduce installed app size by ~300MB #4824

Mergedwukko(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/4824/headmerged by juliusmarminge View on GitHub

What Changed

Desktop app builds now:

  • Omit unused binaries from Claude SDK
  • Drop unused language packs (T3 Code is en-US only)
  • Pack dependencies into ASAR on compatible platforms (macOS/Linux) and retain the Windows-only unpacking for WSL

Why

The current version of the T3 Code desktop app is unreasonably huge: ~737 MB on arm64 macOS. This made me wonder why it's this big, and turns out it's pretty trivial to fix.

This PR brings it down to ~424 MB without any functional changes:

image

UI Changes

None.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Note

Medium Risk Packaging-only change with a behavioral shift on macOS/Linux (no explicit asarUnpack); risk is native/runtime loading if anything still expected unpacked paths outside smart unpack—Windows WSL path remains explicitly unpacked.

Overview Cuts installed desktop size (~737MB → ~424MB on arm64 macOS) by tightening electron-builder packaging in createBuildConfig, without changing runtime behavior for normal macOS/Linux backends.

Locale and dependency trimming: All platforms now set electronLanguages to en-US and add files exclusions that drop optional @anthropic-ai/claude-agent-sdk-* platform bundles (the app uses the user’s Claude binary, so those ~200MB packages are unused).

Platform-specific ASAR unpacking: asarUnpack is applied only on Windows via WINDOWS_ASAR_UNPACK (apps/server/dist/** and **/node_modules/** for the WSL backend). macOS and Linux builds no longer set asarUnpack; the old global DESKTOP_ASAR_UNPACK for @ff-labs/fff-bin-* is removed, with comments that native libs are handled via smart unpack / app.asar.unpacked (aligned with the fff-node patch).

Tests were updated to assert the new constants and that mac/linux configs omit asarUnpack while Windows keeps the WSL unpack list.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit f424416a0766f441c508afd77c1ae76ccb4ad86c. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Reduce desktop app installed size by ~300MB

  • Limits Electron locales to en-US via electronLanguages in createBuildConfig, dropping unused locale files.
  • Excludes optional Claude SDK platform bundles (@anthropic-ai/claude-agent-sdk-*) from packaged files via new DESKTOP_FILE_EXCLUSIONS constant.
  • Makes asarUnpack Windows-only using WINDOWS_ASAR_UNPACK; macOS and Linux builds no longer unpack asar contents.
  • Removes the old DESKTOP_ASAR_UNPACK constant that unconditionally unpacked @ff-labs/fff-bin-* on all platforms.
  • Behavioral Change: macOS and Linux builds no longer include asarUnpack, which may affect native module loading if any path relied on unpacked asar access.
Macroscope summarized f424416.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro Plus

      Run ID: 57817d93-dc15-46bf-9357-b0406c2fdd13

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    3. Approvability

      Verdict: Approved ff0f7ea

      Build/packaging optimization changes only - limits Electron locales to en-US, excludes unused SDK executables, and makes asar unpacking Windows-specific. No runtime logic changes, well-documented rationale, and includes test coverage.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. juliusmarminge merged this72b960f

    5. juliusmarminge closed this

    6. I know this is already merged, but build size is something I care about and needed to add my two-cents.

      I've dived through electron-builders output semi extensivly before. I've done it before with an extensive deny lists, but a restrictive allow list is simpler.

      Node packages include often sourcecode and documentation in their releases. Which isn't really a bad thing, but electron-builder doesn't know any better and takes everything.

      I made this change

      export const DESKTOP_FILE_EXCLUSIONS = [
        "apps/server/dist/**/*",
        "apps/desktop/dist-electron/**/*",
        // electron-builder takes *everything* in the node_modules folder.
        // which is far too much. So lets filter out the entire folder and
        // use an allow list to add only what we want.
        "!**/node_modules/**/*",
      
        // We want all JS, node native extensions and json files.
        "**/node_modules/**/{*.js,*.mjs,*.cjs,*.node,*.json}",
      
        // But not tests or examples.
        "!**/node_modules/*/{test,__tests__,tests,powered-test,example,examples}",
        "!**/node_modules/@*/*/{test,__tests__,tests,powered-test,example,examples}",
      ] as const;

      and reduced the installer size from 146MB to 125MB, and the 'node_modules' folder from 141MB to 71MB.

      It should have more testing done, but it does produce an application that launches.

Sign in to join this conversation.