Rolldown "Run build with devtools" produces a development build (inherits the dev server's NODE_ENV)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 84/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- node.js, typescript, vite
- 領域
- build-system, devtools
調査の方向性
packages/rolldown/src/node/rolldown/build-runner.ts、特に getBuildCommand() とそこからの ctx.terminals.startChildProcess() の呼び出しから始め、実行中の Vite dev server で問題を再現し、生成された bundle を単純な vite build と比較します。Run build with devtools が production の NODE_ENV を使用し、確認コマンドがその環境を反映し、Rolldown の分析が単純な production build と一致すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
The Rolldown panel's Run build with devtools button (vite:rolldown:run-build) produces a development bundle, not a production one. Every size, chunk and duplicate-package figure the Rolldown panel then shows for that session describes the wrong build.
In our Vue app, the button's build ships 259.2 KB gz of first-load JS, while a plain vite build of the same commit ships 200.9 KB gz. The button's build keeps Vue's dev warnings, Pinia's devtools plugin and @vue/devtools-kit in the first-load chunk. The build log still prints building client environment for production, so nothing looks wrong from the outside.
Mechanism:
- The dev server sets
process.env.NODE_ENV = 'development'at startup when it is unset (viteresolveConfig,isNodeEnvSet/defaultNodeEnv). getBuildCommand()spawnsvite buildthroughctx.terminals.startChildProcess()withenv: { VITE_DEVTOOLS_ROLLDOWN: 'true' }(build-runner.ts#L41-L48). The hub merges that onto the dev server'sprocess.env, so the child inheritsNODE_ENV=development.vite buildkeeps an already-setNODE_ENV(documented:NODE_ENV=development vite buildis how you ask for a development build), and replacesprocess.env.NODE_ENVin library code withprocess.env.NODE_ENV || mode. So everyif (process.env.NODE_ENV !== 'production')branch stays in the bundle.
Passing the parent env through in startChildProcess() seems right in general (PATH, proxies, the user's own variables), so the fix probably belongs here: the build runner should set NODE_ENV: 'production', which is what a plain vite build resolves to. The confirmation dialog would then also show the real command line: NODE_ENV=production VITE_DEVTOOLS_ROLLDOWN=true vite build.
Reproduction
Inline steps below; the key part needs a running Vite dev server with DevTools.
- Any Vite 8 app with
@vitejs/devtools+@vitejs/devtools-rolldown0.7.5 and a dependency that hasprocess.env.NODE_ENVbranches (e.g. Vue + Pinia). vite(dev), open DevTools → Rolldown → Run build with devtools.- Compare the new session's first-load size and the
dist/output with a plainvite buildfrom a fresh shell: the button's build is larger and contains dev-only code (for Vue,__VUE_DEVTOOLS_GLOBAL_HOOK__strings appear indist/assets/*.js).
The Vite behaviour alone, without DevTools (Vite 8.3.0):
# index.html: <script type="module" src="./main.js"></script>
# main.js:
# if (process.env.NODE_ENV !== 'production') console.log('DEV-ONLY-BRANCH')
# console.log('app')
vite build --outDir clean # what a user runs
NODE_ENV=development vite build --outDir inherited # what the button's child effectively runs
grep -l DEV-ONLY-BRANCH clean/assets/*.js # no match: dev branch removed
grep -l DEV-ONLY-BRANCH inherited/assets/*.js # match: dev branch kept
Expected: the button's build matches a plain vite build (production NODE_ENV).
Actual: it is a development build, and the Rolldown panel analyses that.
System Info
OS: Windows 11 Pro 10.0.26200 (x64)
Node: 24.21.0
pnpm: 12.5.1
@vitejs/devtools / @vitejs/devtools-rolldown: 0.7.5 (also upstream main ad2d6df)
devframe / @devframes/hub: 1.0.0
vite: 8.3.0
Used Package Manager
pnpm
Validations
- Follow our Code of Conduct
- Read the Contributing Guide.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
- The provided reproduction is a minimal reproducible of the bug.
- 主要言語
- TypeScript
- スター
- 1.2k
- フォーク
- 91
- 平均マージ
- 1日 3時間
- マージ済み PR(30日)
- 21
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
vitejs/devtools のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
vitejs/devtools#589 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
vitejs/devtools#261 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
feat(oxc): add rule timing stats to the lint inspector対応中かも @yuyinws が 8 日前に担当しました。 オープンenhancement
vitejs/devtools#584 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
pending triage
難易度 3/5 1〜2日 初心者へのやさしさ 58/100
メンテナーはふだん 1 日以内に返信
-
pending triage
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
vitejs/devtools#571 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
vitejs/devtools の issue をすべて見る
似ている issue
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
StabilityNexus/Fate-EVM-Frontend#153 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
code-yeongyu/oh-my-openagent#9039 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
Tencent/teamai-cli#862 ·
メンテナーはふだん 1 日以内に返信
-
bug good first issue hacktoberfest redis
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
libredb/libredb-studio#1164 ·
メンテナーはふだん 1 日以内に返信
-
flake
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信