TanStack AI version#
@tanstack/ai-claude-code 1.0.1, @tanstack/ai-sandbox 1.1.0 (@tanstack/ai 1.1.0)
Framework/Library version#
Vite 8.0.0 (Rolldown), TanStack Start 1.169, Nitro 3
Describe the bug and the steps to reproduce it#
@tanstack/ai and @tanstack/ai-skills set "sideEffects": false in package.json. @tanstack/ai-claude-code and @tanstack/ai-sandbox do not. So a bundler must keep every module that the root entry of @tanstack/ai-claude-code imports, also when the app uses only translateSdkStream.
- Import only the translator in a server module:
import { translateSdkStream } from "@tanstack/ai-claude-code"
- Build with Vite 8 (Rolldown).
- The server output keeps side-effect imports of
@modelcontextprotocol/sdk (types.js plus ajv, about 475 kB) and of hono with @hono/node-server (about 27 kB). They come from @tanstack/ai-sandbox/dist/esm/tool-bridge.js through the root entry of @tanstack/ai-claude-code. No sandbox code is called.
With this Rolldown rule, both imports go away and the build still works:
build: {
rolldownOptions: {
treeshake: {
moduleSideEffects: [
{ test: /\/@tanstack\/ai-(claude-code|sandbox)\//, sideEffects: false },
],
},
},
},
Expected: "sideEffects": false in both packages, as in @tanstack/ai. A subpath export for the translator, such as @tanstack/ai-claude-code/translate, would also let an app that only translates stream-json skip the required @tanstack/ai-sandbox peer.
Your Minimal, Reproducible Example - (Sandbox Highly Recommended)#
The steps above. The rule shows the fix.