fix(cli): traverse parent directories to find vite.config.ts in vp pack#1072
fix(cli): traverse parent directories to find vite.config.ts in vp pack#1072kazupon wants to merge 6 commits intovoidzero-dev:mainfrom
Conversation
✅ Deploy Preview for viteplus-preview canceled.
|
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
What about other commands? Does the build need to consider similar logic? |
|
Good point! I investigated how each command resolves vite config:
Since vite+ is the unified toolchain and users interact through For |
|
One thing I noticed during this investigation, the vite config resolution layer is currently split across JS and Rust:
The Rust side handles config resolution for Since vite+ unifies tool configuration through The solution to this root cause goes well beyond the scope of this issue. |
There was a problem hiding this comment.
💡 Codex Review
vite-plus/packages/cli/src/pack-bin.ts
Lines 139 to 142 in ec46391
If the newly discovered workspace-root vite.config.* contains pack: [...], this code will execute every entry even when vp pack is launched from a single package directory. There is no cwd-based narrowing before iterating viteConfig.pack, so a monorepo script like vp run foo#build can unexpectedly build sibling packages unless the user manually adds -F; that defeats the point of making package-local invocations reuse the parent config.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
packages/cli/src/pack-bin.ts
Outdated
|
|
||
| async function runBuild() { | ||
| const viteConfig = await resolveViteConfig(process.cwd()); | ||
| const viteConfig = await resolveViteConfig(process.cwd(), { traverseUp: true }); |
There was a problem hiding this comment.
Respect
--no-config before traversing to parent configs
vp pack advertises --no-config as disabling config-file loading, but this branch now unconditionally calls resolveViteConfig(..., { traverseUp: true }). In a workspace package with a shared root vite.config.*, vp pack --no-config will still pick up that parent config and apply its pack settings, which changes entries/output/plugins compared with a true no-config build. This regression is new because the parent config was not discovered before traverseUp was added.
Useful? React with 👍 / 👎.
As I understand it, tasks are cached by |
|
To use Codex here, create an environment for this repo. |
|
I reconsidered the behavior of
For I'll keep |
| const VITE_CONFIG_FILES = [ | ||
| 'vite.config.js', | ||
| 'vite.config.mjs', | ||
| 'vite.config.ts', |
There was a problem hiding this comment.
In the vast majority of cases it's the vite.config.ts file, put it first so there will only be one file IO operation
resolve #942