Optimize npm package size by downloading platform-specific binaries in postinstall (~100MB -> ~20MB)

Resolved 💬 2 comments Opened Aug 27, 2025 by vinaybantupalli Closed Jan 10, 2026

What feature would you like to see?

The current npm package bundles binaries for all platforms, but only one platform-specific binary is needed per installation.

Current Behavior

  • All platform binaries are included via install_native_deps.sh in stage_release.sh
  • Runtime platform detection in bin/codex.js selects the correct binary

Proposed Solution
Replace the current approach with a postinstall script that downloads only the required binary based on the platform:

  • Postinstall script detects platform and downloads appropriate binary from GitHub Releases
  • Binary to be served from github releases instead of npm registry
  • Update stage_release.sh to publish lightweight package

Are you interested in implementing this feature?

Yes

Additional information

Binary will be served from github releases instead of npm registry after this - so need to check how versioning is setup github release packages

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗