Skip to content

Configuration for lock file location to fix issues with dependency optimizer #20817

@benjamind

Description

@benjamind

Description

We have noticed that Vite does not work properly with the Rushjs monorepo tool because it uses a unique pnpm store that moves the pnpm-lock.yaml file into a non standard, but shared location across the monorepo.

The dependency optimizer code currently assumes a location for the lock file, and this location is not configurable. If the lock file is not found then the hash is computed based on an empty string, so the dependency optimizer never changes the cache. This results in many failed builds making vite unusable, especially as disabling the optimizer also makes it hard to use commonjs modules.

https://github.com/vitejs/vite/blob/main/packages/vite/src/node/optimizer/index.ts#L1294

Suggest you add a configuration property to specify the location and format of the lockfile, this would then make vite usable with a variety of monorepo tools.

Suggested solution

Add a lockFilePath configuration property to specify the location of lock file used by the dependency optimizer.

Alternative

No response

Additional context

No response

Validations

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions