Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a critical bug in the vite lib command where it was using the workspace root directory instead of the package's current working directory when generating the Vite lib config in monorepo setups, causing builds to fail or produce incorrect output.
Key Changes:
- Updated the
libcommand to use the current working directory (cwd) instead ofworkspace.root_dir()when writing the Vite lib configuration - Added comprehensive snapshot tests for the
libcommand in a monorepo environment to verify the fix and prevent regressions
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/cli/binding/src/cli.rs | Fixed the directory path used in write_vite_lib_config to use cwd instead of workspace.root_dir(), and added necessary clone of cwd since it's used twice in the command handler |
| packages/cli/snap-tests/command-lib-monorepo/steps.json | Added test steps to verify the lib command works in monorepo packages, including build and caching verification |
| packages/cli/snap-tests/command-lib-monorepo/snap.txt | Expected output snapshot showing successful library builds and cache hits in monorepo context |
| packages/cli/snap-tests/command-lib-monorepo/packages/hello/tsdown.config.ts | Test fixture configuration for the library build tool |
| packages/cli/snap-tests/command-lib-monorepo/packages/hello/src/index.ts | Test fixture entry point for the library |
| packages/cli/snap-tests/command-lib-monorepo/packages/hello/src/hello.ts | Test fixture module demonstrating basic library functionality |
| packages/cli/snap-tests/command-lib-monorepo/packages/hello/package.json | Test fixture package definition with build script using vite lib |
| packages/cli/snap-tests/command-lib-monorepo/package.json | Monorepo workspace root configuration for the test fixture |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Brooooooklyn
approved these changes
Dec 24, 2025
Member
Author
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.

TL;DR
Fix the
vite libcommand to work correctly in monorepo packages by using the correct directory path.What changed?
libcommand in the CLI to use the correct directory path when generating the Vite lib configlibcommand in a monorepo setup to verify the fixHow to test?
vite liborvite run <package>#buildwhere the package usesvite libin its build scriptWhy make this change?
When running the
vite libcommand in a package within a monorepo, the command was incorrectly using the workspace root directory instead of the package directory to generate the Vite configuration. This caused the build to fail or produce incorrect output. This fix ensures that the command works correctly in monorepo setups by using the current working directory of the package.