Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ensure pnpm binary is only called in vite dir to get vite package info #278

Merged
merged 1 commit into from
Jan 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -611,8 +611,12 @@ async function buildOverrides(
*/
async function getVitePackageInfo(vitePath: string): Promise<PackageInfo> {
try {
const lsOutput = await $`pnpm --dir ${vitePath}/packages/vite ls --json`
const lsParsed = JSON.parse(lsOutput)
// run in vite dir to avoid package manager mismatch error from corepack
const current = cwd
cd(`${vitePath}/packages/vite`)
const lsOutput = $`pnpm ls --json`
cd(current)
const lsParsed = JSON.parse(await lsOutput)
return lsParsed[0] as PackageInfo
} catch (e) {
console.error('failed to retrieve vite package infos', e)
Expand Down