ai-claude-code and ai-sandbox: add "sideEffects": false so translateSdkStream tree-shakes

未关闭
#2,032 0 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@tombeckenham 已经在做这个了。

开始于 2026年11月4日。

评估

这个 Issue 还没有评估数据。

描述

waiting-on: maintainer
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.

  1. Import only the translator in a server module:
    import { translateSdkStream } from "@tanstack/ai-claude-code"
    
  2. Build with Vite 8 (Rolldown).
  3. 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.

主要语言
TypeScript
星标
3.3k
派生
378
平均合并
1 天 2 小时
30 天内合并 PR
254

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

TanStack/ai 的其他 Issue

查看 TanStack/ai 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。