fix(rolldown): run the devtools build with a production NODE_ENV - #587
Open
zahidzorbaz wants to merge 1 commit into
Open
zahidzorbaz wants to merge 1 commit into
zahidzorbaz wants to merge 1 commit into
Conversation
"Run build with devtools" spawns `vite build` from the dev server, so the child inherits `NODE_ENV=development` that Vite set for the dev server. `vite build` keeps an already-set `NODE_ENV`, so the build kept every library's dev-only branches and the Rolldown panel analysed a development bundle. Pin `NODE_ENV=production`, which is what a plain `vite build` resolves to. Fixes vitejs#586 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The Rolldown panel's Run build with devtools produced a development bundle. The button spawns
vite buildfrom the running dev server, and the hub'sstartChildProcess()passes the parent env through, so the child inherits theNODE_ENV=developmentthat Vite sets for the dev server.vite buildkeeps an already-setNODE_ENVand replacesprocess.env.NODE_ENVwithprocess.env.NODE_ENV || mode, so every library's dev-only branches stayed in the bundle the panel then analysed.getBuildCommand()now setsNODE_ENV: 'production', which is what a plainvite buildresolves to. The confirmation dialog shows it too:NODE_ENV=production VITE_DEVTOOLS_ROLLDOWN=true vite build.The hub keeps passing the env through, since terminal sessions generally need the parent env (PATH, proxies, user variables). The build runner is the caller that knows the build must not inherit the dev server's
NODE_ENV.Linked Issues
Fixes #586
Additional context
packages/rolldown/src/node/rolldown/__tests__/build-runner.test.tschecksgetBuildCommand()and the optionsstartBuild()passes tostartChildProcess(). Both fail onmain.vite builddrops anif (process.env.NODE_ENV !== 'production')branch, whileNODE_ENV=development vite buildkeeps it.vite buildof the same commit (@vue/devtools-kitonly in the former).pnpm lint,pnpm typecheckandpnpm buildpass.pnpm testpasses except the two locale-dependentpackages/uibytesToHumanSizecases, which fail the same way on a cleanmainhere (tr-TR locale).🤖 Generated with Claude Code