fix(supabase): split type-only exports to avoid unused import warnings #1979
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🔍 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.