Skip to content

fix(tanstack-ai): enable tree-shaking for top-level imports - #645

Open
Sakib25800 wants to merge 1 commit into
cloudflare:mainfrom
Sakib25800:fix/tanstack-ai-tree-shaking
Open

fix(tanstack-ai): enable tree-shaking for top-level imports#645
Sakib25800 wants to merge 1 commit into
cloudflare:mainfrom
Sakib25800:fix/tanstack-ai-tree-shaking

Conversation

@Sakib25800

@Sakib25800 Sakib25800 commented Aug 22, 2026

Copy link
Copy Markdown

Summary

Top-level imports from @cloudflare/tanstack-ai retained unused adapters and their dependencies because the package was not marked as side-effect free.

Add "sideEffects": false so bundlers can remove any unused adapter exported by the top-level entry point. This PR also includes the required patch changeset.

Verification

The createGeminiChat example from #609 example shows the esbuild metafile comparison:

Import Contributing inputs Bundle size
Top-level before 273 730,922 bytes
Top-level after 33 425,848 bytes
Direct adapter subpath 33 425,848 bytes

After the change, the top-level and direct-import builds have identical contributing module graphs.

Closes #609

@changeset-bot

changeset-bot Bot commented Aug 22, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a95ae3c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@cloudflare/tanstack-ai Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

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.

[tanstack-ai] bug: Tree-shaking not working when importing from the top-level package

1 participant