Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Sep 24, 2025

  • Analyzed the issue: Vite's dependency optimizer assumes hardcoded lockfile locations, making it incompatible with Rush.js monorepos
  • Reviewed current implementation in packages/vite/src/node/optimizer/index.ts
  • Understood getLockfileHash function and lockfileFormats array
  • Built and linted the project to establish baseline
  • Add support for detecting Rush.js lockfiles automatically by adding .rush/temp/shrinkwrap-deps.json to lockfileFormats
  • Remove all other changes per maintainer feedback - keep only the Rush.js lockfile format addition
  • Reposition Rush.js lockfile entry to be right after pnpm lockfile entry for better organization
  • Run linting and build to ensure changes work properly
  • Verify all existing tests still pass

Implementation Details

Rush.js Lockfile Support

Added Rush.js lockfile format to the lockfileFormats array to enable automatic detection of .rush/temp/shrinkwrap-deps.json files. The entry is positioned right after the pnpm lockfile entry since Rush.js uses pnpm internally.

This minimal change resolves the core issue where Vite fails to work with Rush.js monorepos due to non-standard lockfile locations, without adding any new configuration options.


Additional instructions:

Add the code to optimizer/index.ts

Fixes #20817


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Copilot Copilot AI changed the title [WIP] Configuration for lock file location to fix issues with dependency optimizer feat: add lockFilePath configuration for dependency optimizer to support monorepos Sep 24, 2025
@Copilot Copilot AI requested a review from sapphi-red September 24, 2025 11:51
Copilot finished work on behalf of sapphi-red September 24, 2025 11:51
@Copilot Copilot AI changed the title feat: add lockFilePath configuration for dependency optimizer to support monorepos feat: add Rush.js lockfile support for dependency optimizer Sep 24, 2025
Copilot finished work on behalf of sapphi-red September 24, 2025 11:59
@Copilot Copilot AI requested a review from sapphi-red September 24, 2025 11:59
@Copilot Copilot AI requested a review from sapphi-red September 24, 2025 12:36
Copilot finished work on behalf of sapphi-red September 24, 2025 12:36
@sapphi-red sapphi-red marked this pull request as ready for review September 24, 2025 12:37
@sapphi-red sapphi-red added p2-nice-to-have Not breaking anything but nice to have (priority) feat: deps optimizer Esbuild Dependencies Optimization labels Sep 24, 2025
@sapphi-red sapphi-red added this to the 7.2 milestone Sep 24, 2025
Copy link
Member

@bluwy bluwy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should also uncomment this if we somewhat have rush support now:

It was added in https://github.com/vitejs/vite/pull/2850/files#diff-64df9f2b7e879d5f5da8a632345e240f078cbb36a258ec5c92752744d02a87c9R13

@bluwy bluwy changed the title feat: add Rush.js lockfile support for dependency optimizer feat(optimizer): add rush lockfile support Sep 24, 2025
@sapphi-red
Copy link
Member

I think we can add that too (maybe also with nx #20090). But I guess we should add it in a major because it will allow more files in fs.strict.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat: deps optimizer Esbuild Dependencies Optimization p2-nice-to-have Not breaking anything but nice to have (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Configuration for lock file location to fix issues with dependency optimizer
3 participants