fix(supabase): split type-only exports to avoid unused import warnings#1979
fix(supabase): split type-only exports to avoid unused import warnings#1979mandarini merged 1 commit intosupabase:masterfrom
Conversation
|
@nicokempe thank you for the PR. Can you please make sure your commit message matches the required pattern for conventional commits? You can use the commit wizard to help you, run |
|
@nicokempe nevermind, I merged with message from PR title |
Thank you and sorry @mandarini, I have gotten into the habit of defining the issue ID (#1973 in this case) as the scope based on the conventions of other projects that I work on so that the reason for the commit can be found quickly, but I understand why you would not want to do it that way. Thank you very much for updating. |
|
@nicokempe oh I see. Yes, we do it that way because we have some release automation around it, so that it can group fixes/feats according to the scope in the packages changelogs. |
🔍 Description
This PR separates type-only exports from runtime re-exports in the
supabase-jsentrypoint to prevent bundlers from emitting false-positive “imported but never used” warnings during dev builds.No runtime behavior is changed.
What changed?
PostgrestErrorandFunctionInvokeOptionsto type-only exportsFunctionsClient,FunctionsError, etc.) unchangedThis ensures bundlers can safely tree-shake unused exports without leaving behind unused imports.
Why was this change needed?
When running
pnpm dev(Nuxt / Vite / Rollup pipeline in my case), the bundler performs dependency optimization and tree-shaking.Because
supabase-jspreviously imported runtime-used symbols (e.g.PostgrestClient) together with symbols that are only re-exported for typing purposes (e.g.PostgrestError), tree-shaking removed the re-exports but left the combined import intact. This resulted in warnings such as:These warnings are not runtime issues, but they create noise for users during development.
Splitting type-only exports avoids this pattern and aligns better with how bundlers handle ESM + TypeScript.
Closes #1973
📸 Screenshots/Examples
Before:
🔄 Breaking changes
📋 Checklist
<type>(<scope>): <description>npx nx formatto ensure consistent code formatting📝 Additional notes
This change is intentionally minimal and focused on improving developer experience during bundling. It does not affect runtime behavior, public APIs, or existing imports, and only refines how types are exported for downstream tooling compatibility.