@modelcontextprotocol/ext-apps consumers ship ~140K of unused zod v4 locale files in browser bundles
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 52/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- rollup, typescript, vite
調査の方向性
les2/mcp-ext-apps-zod-locale-bloat にある最小再現から始め、npm install && npm run compare を実行してバンドルの差分を確認します。SDK の zod のインポートパスと、Vite または Rollup が locale の再エクスポートをどのように処理するかを追跡します。ブラウザーのコンシューマーが、コンシューマー側の回避策を必要とせずに未使用の zod locale ファイルを含めなくなれば完了です。
索引モデルが issue の本文から書いたものです。
説明
I discovered while developing an mcp-app using the sdk (client side only) that the bundle contained all of zod's locales because of a start import that prevented vite's / rolldown's tree-shaking from working.
I was able to work around this by developing (with the help of AI) a little vite plugin to strip it:
// Zod v4 re-exports every locale via `export * as locales` from its classic
// entrypoint, which defeats tree-shaking when the MCP SDK imports `* as z from
// 'zod/v4'`. Replace the locales index with an `en`-only stub so the namespace
// still exists but the other ~50 locale files never enter the graph.
const zodLocalesEnOnly = {
name: "zod-locales-en-only",
enforce: "pre",
load(id) {
if (/[\\/]zod[\\/](?:v4[\\/])?locales[\\/]index\.js$/.test(id)) {
return 'export { default as en } from "./en.js";';
}
return null;
},
};
See https://github.com/les2/mcp-ext-apps-zod-locale-bloat for a minimal demonstration of the issue.
Below is an AI issue description:
@modelcontextprotocol/ext-apps consumers ship ~140K of unused zod v4 locale files in browser bundles
Summary
Any browser app that depends on @modelcontextprotocol/ext-apps (and therefore on @modelcontextprotocol/sdk) bundles all ~50 zod v4 locale files — Spanish, French, German, Japanese, Chinese, Korean, Russian, etc. — because of a tree-shaking dead-end in the transitive zod chain. On our widget (Ember + Vite + Rollup) this was ~140K of dead weight, ~20% of the final bundle.
The end result is that every browser bundle currently ships translated error strings like 数値過大:期望, Trop court, demasiado corto, zu kurz — none of which are ever displayed, since the SDK only uses zod's English error messages at runtime.
A minimal reproduction is available at https://github.com/les2/mcp-ext-apps-zod-locale-bloat — npm install && npm run compare builds twice (without and with the workaround) and prints the size delta.
- 主要言語
- TypeScript
- スター
- 2.9k
- フォーク
- 387
- 平均マージ
- 2時間 54分
- マージ済み PR(30日)
- 7
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
modelcontextprotocol/ext-apps のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
modelcontextprotocol/ext-apps#786 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
modelcontextprotocol/ext-apps#767 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
modelcontextprotocol/ext-apps#742 · コメント 1 件 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
modelcontextprotocol/ext-apps#711 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
modelcontextprotocol/ext-apps#706 ·
modelcontextprotocol/ext-apps の issue をすべて見る
似ている issue
-
VerificationGate: ATTRIBUTION quote guard never matches a normal quotation (\b around the quote) オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
danielmiessler/LifeOS#2234 ·
-
T: Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
-
Mend: dependency security vulnerability untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100