Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

@modelcontextprotocol/ext-apps consumers ship ~140K of unused zod v4 locale files in browser bundles

オープン
#665 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
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-bloatnpm 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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

modelcontextprotocol/ext-apps のほかの issue

modelcontextprotocol/ext-apps の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。