optimisation warning conflicts with large React library barrels
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 54/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- react, typescript, vite
調査の方向性
Start with the plugin-rsc use-client optimization warning and reproduce it using the linked vite-rsc-bundling example: run npm install and npm run dev, then open the app. Compare the warning and browser requests for the lucide-react barrel import with the subpath import workaround described in the issue. Done means finding a way to avoid the warning without requesting the full icon module graph during development.
索引モデルが issue の本文から書いたものです。
説明
Related plugins
Describe the bug
When a React library has a large barrel entry, @vitejs/plugin-rsc warns that the dependency is inconsistently optimised:
16:30:30 [vite] (rsc) warning: client component dependency is inconsistently optimized. It's recommended to add the dependency to 'optimizeDeps.exclude'.
Plugin: rsc:use-client
File: /Users/karl.stoney/git/vite-rsc-bundling/node_modules/lucide-react/dist/esm/Icon.mjs?v=233653df
16:30:31 [vite] (rsc) warning: client component dependency is inconsistently optimized. It's recommended to add the dependency to 'optimizeDeps.exclude'.
Plugin: rsc:use-client
File: /Users/karl.stoney/git/vite-rsc-bundling/node_modules/lucide-react/dist/esm/context.mjs?v=233653df
For lucide-react, following that recommendation removes the warning but causes the browser to request the entire icon module graph (2000+ icons individually) during development, even when only one icon is used.
There is a workaround in my repro (not using the barrel import, and importing from subpaths directly) but it seems odd to need to do this.
Reproduction
https://github.com/Stono/vite-rsc-bundling
Steps to reproduce
npm install then npm run dev, then open it. More info in the README
System Info
System:
OS: macOS 26.6.1
CPU: (14) arm64 Apple M4 Max
Memory: 928.25 MB / 36.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 24.22.2 - /Users/karl.stoney/.local/state/fnm_multishells/79801_1794241455736/bin/node
npm: 11.19.1 - /Users/karl.stoney/.local/state/fnm_multishells/79801_1794241455736/bin/npm
Browsers:
Safari: 27.0
npmPackages:
@vitejs/plugin-rsc: 0.5.39 => 0.5.39
vite: 8.3.7 => 8.3.7
Used Package Manager
npm
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
- 主要言語
- TypeScript
- スター
- 1.2k
- フォーク
- 287
- 平均マージ
- 1日 17時間
- マージ済み PR(30日)
- 19
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
vitejs/vite-plugin-react のほかの issue
-
plugin-rsc: a client reference's CSS is linked before the CSS of the chunks it imports (build)対応中かも @wozhenbang2004 が 6 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
vitejs/vite-plugin-react#1570 ·
メンテナーはふだん 1 日以内に返信
-
pending triage
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
vitejs/vite-plugin-react#1581 ·
メンテナーはふだん 1 日以内に返信
-
[plugin-rsc] Build exits 0, but the app fails at runtime: a server action imported only by browser code is missing from the RSC build対応中かも @NeilPant が 3 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
vitejs/vite-plugin-react#1578 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 42/100
vitejs/vite-plugin-react#1577 ·
メンテナーはふだん 1 日以内に返信
-
[plugin-rsc] inline "use server" function declarations lose hoisting and throw TDZ ReferenceError対応中かも @draarivpatel-ui が 2 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
vitejs/vite-plugin-react#1566 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
vitejs/vite-plugin-react の issue をすべて見る
似ている issue
-
ui
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
mermaid-js/mermaid-v13#1370 ·
メンテナーはふだん 1 日以内に返信
-
compiler: the island_chunks_not_emitted report gives a count but not which islands were skippedオープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
Broken Website
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
darkreader/darkreader#16259 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
ARTPARK-SAHAI-ORG/calibrate-frontend#919 ·
メンテナーはふだん 1 日以内に返信