<< All versions
Skill v1.0.0
currentLLM-judged scan90/100keybase/client/prod-bundles
──Details
PublishedOctober 20, 2026 at 03:54 AM
Content Hashsha256:bd899b77e494ce6c...
Git SHA594ed87ee49c
──Files
Files (1 file, 2.4 KB)
SKILL.md2.4 KBactive
SKILL.md · 64 lines · 2.4 KB
version: "1.0.0" name: prod-bundles description: Use when the user asks to build production bundles, check bundle sizes, audit tree-shaking, or verify mobile/desktop code separation. Covers both the desktop Vite prod build and the iOS/Android Metro bundle.
Build production bundles for both platforms and analyze them for correct tree-shaking.
Build Commands
Desktop (Vite):
bash
# From shared/yarn desktop:build:prod
Output lands in shared/desktop/dist/. Prod bundles have no .dev or .profile suffix — filter with:
bash
ls shared/desktop/dist/*.bundle.js | grep -v '\.dev\.' | grep -v '\.profile\.'
iOS (Metro):
bash
# From shared/yarn ios:jsbundle
Output: shared/ios/dist/main.jsbundle
Android (Metro):
bash
# From shared/yarn android:jsbundle
Output: shared/android/dist/main.jsbundle
Tree-Shaking Audit
Desktop — check mobile-only modules are absent:
bash
DIST=shared/desktop/distPROD=$(ls "$DIST"/*.bundle.js | grep -v '\.dev\.' | grep -v '\.profile\.')for mod in expo-audio expo-location expo-video react-native-kb @gorhom/bottom-sheet lottie-react-native react-native-safe-area-context; dohits=$(echo "$PROD" | xargs grep -l "$mod" 2>/dev/null | wc -l | tr -d ' ')echo "$mod: $hits files"done
iOS bundle — check bare `isMobile`/`isElectron` are inlined as literals (Babel plugin):
bash
# Should report 0 occurrences — bare globals replaced with true/false at transform timepython3 -c "import rebundle = open('shared/ios/dist/main.jsbundle').read()for name in ['isMobile', 'isElectron', 'isAndroid', 'isIOS']:real = [m for m in re.finditer(r'(?<![.\w{,])' + name + r'(?![:\w])', bundle)]print(f'{name} not as property/key: {len(real)} occurrences')"
Key Facts
- Vite (desktop): the
defineblock inshared/vite.config.mts(makeDefines) replaces bare globals (isMobile,isElectron, etc.) with literals, and the prod minifier drops the dead branches. - Metro (iOS/Android): The
makePlatformPluginBabel plugin inbabel.config.jsinlines the same globals at transform time, enabling Metro'sconstant-folding-pluginto DCE dead branches. - Native-only module aliasing (desktop): packages in
shared/native-only-modules.jsare aliased toshared/null-module.jsby the resolve config inshared/vite.config.mts, and pre-bundled throughoptimizeDeps. After changing that file, clear Vite's dep cache:rm -rf shared/node_modules/.vite.