Skip to content

Conversation

@mandarini
Copy link
Contributor

@mandarini mandarini commented Oct 20, 2025

Description

Fixes "Cannot find module 'tslib'" errors in Expo integration tests by adding tslib as an explicit dependency to all core packages.

Problem

All core packages (auth-js, functions-js, postgrest-js, realtime-js, storage-js) compile with importHelpers: true in their TypeScript config, which generates code that calls tslib helper functions at runtime. However, tslib was not declared as a dependency in any of these packages.
This worked in most environments due to dependency hoisting (other packages providing tslib), but failed in isolated environments like our CI Expo tests where packages are installed from tarballs with fresh npm install.

Why use tslib in the first place

The monorepo uses importHelpers: true in tsconfig.base.json, which instructs TypeScript to import helper functions from tslib instead of inlining them into every compiled file. This significantly reduces bundle size by avoiding duplication of helper code for async/await, spread operators, and other TypeScript transformations across all modules. While this was already generating require("tslib") calls in the compiled output, the dependency wasn't explicitly declared, causing it to work only when tslib was coincidentally available through other packages' dependencies. This fix makes the implicit dependency explicit, ensuring reliability across all installation environments.

Solution

Added [email protected] as a direct dependency to all affected core packages.

Type of Change

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

Related Issues

Fixes Expo Tests CI failure that started appearing in recent runs.

Related fix to the tests

Our tests failed to catch this error before making it to production. A fix is under way, more explanation here:
#1795

@mandarini mandarini requested a review from a team as a code owner October 20, 2025 17:12
@github-actions github-actions bot added the supabase-js Related to the supabase-js library. label Oct 20, 2025
@coveralls
Copy link

coveralls commented Oct 20, 2025

Coverage Status

coverage: 95.455% (-0.5%) from 95.986%
when pulling 24c4d48 on chore/fix-expo-tests
into c5ad2f4 on master.

@mandarini mandarini changed the title chore(supabase): expo tests deps update fix(repo): add missing tslib dependency to core packages Oct 20, 2025
@mandarini mandarini marked this pull request as draft October 20, 2025 17:27
@mandarini mandarini marked this pull request as ready for review October 20, 2025 17:32
@mandarini mandarini requested review from a team as code owners October 20, 2025 17:32
@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 21, 2025

Open in StackBlitz

@supabase/auth-js

npm i https://pkg.pr.new/@supabase/auth-js@1789

@supabase/functions-js

npm i https://pkg.pr.new/@supabase/functions-js@1789

@supabase/postgrest-js

npm i https://pkg.pr.new/@supabase/postgrest-js@1789

@supabase/realtime-js

npm i https://pkg.pr.new/@supabase/realtime-js@1789

@supabase/storage-js

npm i https://pkg.pr.new/@supabase/storage-js@1789

@supabase/supabase-js

npm i https://pkg.pr.new/@supabase/supabase-js@1789

commit: 24c4d48

@mandarini mandarini merged commit 11b1989 into master Oct 21, 2025
41 of 44 checks passed
@mandarini mandarini deleted the chore/fix-expo-tests branch October 21, 2025 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

supabase-js Related to the supabase-js library. trigger: preview

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants