Skip to content

fix(ts-sdk): externalize all peerDependencies in tsup config#4408

Merged
whysosaket merged 2 commits intomainfrom
fix/tsup-externalize-peer-deps
Mar 18, 2026
Merged

fix(ts-sdk): externalize all peerDependencies in tsup config#4408
whysosaket merged 2 commits intomainfrom
fix/tsup-externalize-peer-deps

Conversation

@kartik-mem0
Copy link
Copy Markdown
Contributor

Description

The TypeScript SDK (mem0ai/oss) crashes at load time with Cannot find module 'ollama' when users don't have the ollama package installed, even when using a completely different provider (e.g., Gemini, OpenAI). This happens because ollama and 9 other peerDependencies were missing from tsup.config.ts's external array, causing tsup to bundle them inline instead of treating them as external requires.

This PR adds all missing peerDependencies to the external array and includes a drift-prevention test that will fail if a new peerDep is added to package.json without being externalized in tsup.config.ts.

Fixes #3857

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • Verified npm run build passes and bundle compiles cleanly

  • Inspected dist/oss/index.js to confirm require("ollama") is a simple external require (2 lines), not the entire inlined package

  • Confirmed all other newly externalized deps (@google/genai, @mistralai/mistralai, @supabase/supabase-js, etc.) are also externalized correctly

  • Drift-prevention test validates every runtime peerDependency is present in the external array

  • Reverse staleness test validates no orphaned entries exist in the external array

  • Unit Test

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

Maintainer Checklist

… tests

Add dbPath: ":memory:" to prevent shared SQLite file conflicts
when jest runs all test files concurrently in CI.
@whysosaket whysosaket merged commit ffd1b96 into main Mar 18, 2026
5 checks passed
@whysosaket whysosaket deleted the fix/tsup-externalize-peer-deps branch March 18, 2026 18:19
jamebobob pushed a commit to jamebobob/mem0-vigil-recall that referenced this pull request Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TypeScript SDK] Static require('ollama') breaks apps not using Ollama provider

2 participants