@void/react: client environment has no optimizeDeps.entries for pages, causing a dev re-optimization reload on first load
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 66/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript, vite
- 領域
- build-system, devtools
調査の方向性
Start with react/src/plugin-pages.ts around lines 190–218 and 274, then trace how the dev config sets optimizeDeps for the client and worker environments. Reproduce with a cold node_modules/.vite cache and DEBUG=vite:deps vp dev; the issue includes a workaround and measurements. Done when page dependencies and void/pages-prefetch are optimized on the first load without a client reload.
索引モデルが issue の本文から書いたものです。
説明
Summary
In dev, @void/react gives the worker environment a pages/** scan entry but gives the client environment none. Vite's client scanner therefore finds no dependencies, discovers them while serving the first page, re-bundles, and forces a full page reload ((client) optimized dependencies changed. reloading).
- Version:
void/@void/react1.2.1 (latest).mainat 65ab6032 has the same code. packages/react/src/plugin-pages.ts#L190-L218: the client env only getsinclude: CLIENT_OPTIMIZE_DEPS(React);entries: [pagesOptimizeEntries]is set only underenvironments[WORKER_ENVIRONMENT_NAME](L214).- The worker entry was added in ba979d5c ("Fix worker crash in dev on initial load"); its comment explains the worker case only. Nothing in the docs mentions
optimizeDeps. - A second, related gap: the generated client entry imports
void/pages-prefetch(L274). It is a virtual module, so the scanner can't see that import either, andvoid/pages-prefetchis discovered late even when page entries are scanned.
Repro
- A Pages app with a few page components that import third-party UI packages (e.g.
@base-ui/react/*,@tanstack/react-query). rm -rf node_modules/.vite && DEBUG=vite:deps vp dev- Open a page in the browser.
Observed (DEBUG=vite:deps):
(client) Scan completed in 12.74ms: no dependencies found
new dependencies were found while crawling that weren't detected by the scanner
new dependencies found: void/pages-prefetch, @base-ui/react/merge-props, ..., motion/react
(client) optimized dependencies changed. reloading
Measurements (one app, headless Chromium, cold node_modules/.vite, 3 runs per row, numbers summed over the whole load including the reload)
| client config | requests | JS modules | client reload | median time to hydration |
|---|---|---|---|---|
| as shipped | 238 / 231 | 233 / 226 | yes (3/3) | 3981 / 4207 ms |
+ entries only |
239 / 233 | 234 / 228 | yes (3/3, only void/pages-prefetch late) |
4048 / 4091 ms |
+ entries + include: ['void/pages-prefetch'] |
217 / 211 | 214 / 208 | no (0/3) | 3453 / 3180 ms |
(two routes per cell)
Workaround
// vite.config.ts
export default defineConfig({
optimizeDeps: {
entries: ['pages/**/*.{js,jsx,ts,tsx}', '!pages/**/*.server.{js,jsx,ts,tsx}'],
include: ['void/pages-prefetch'],
},
// ...
});
Suggested fix
In the dev config hook of plugin-pages.ts, also pass the page entries (excluding *.server.* companions) to the client optimizeDeps.entries, and add void/pages-prefetch to the client include (it is imported only by the virtual client entry).
- 主要言語
- TypeScript
- スター
- 580
- フォーク
- 56
- 平均マージ
- 11時間 28分
- マージ済み PR(30日)
- 150
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
voidzero-dev/void のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
voidzero-dev/void#619 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
voidzero-dev/void#606 ·
メンテナーはふだん 1 日以内に返信
-
`void/log`: add `logger.child(fields)` to bind fields to every line対応中かも @Dazzanova が今日担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 82/100
voidzero-dev/void#596 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 56/100
voidzero-dev/void#579 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
voidzero-dev/void#573 ·
メンテナーはふだん 1 日以内に返信
voidzero-dev/void の issue をすべて見る
似ている issue
-
backend refactor
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
NIAEFEUP/tts#927 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
callstackincubator/react-native-harness#296 ·
メンテナーはふだん 1 日以内に返信
-
status:in-linear
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
メンテナーはふだん 1 日以内に返信
-
verified
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
メンテナーはふだん 5 日以内に返信
-
Add inputmode attribute support (forwarded to the inner input)再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンenhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Neovici/cosmoz-input#467 ·
メンテナーはふだん 1 日以内に返信