Skip to content

Commit 889eebe

Browse files
authored
fix(optimizer): load the correct lock file (#12700)
1 parent e6eed85 commit 889eebe

File tree

1 file changed

+7
-5
lines changed
  • packages/vite/src/node/optimizer

1 file changed

+7
-5
lines changed

packages/vite/src/node/optimizer/index.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -1236,11 +1236,13 @@ function isSingleDefaultExport(exports: readonly string[]) {
12361236
}
12371237

12381238
const lockfileFormats = [
1239-
{ name: 'package-lock.json', checkPatches: true },
1240-
{ name: 'yarn.lock', checkPatches: true }, // Included in lockfile for v2+
1241-
{ name: 'pnpm-lock.yaml', checkPatches: false }, // Included in lockfile
1242-
{ name: 'bun.lockb', checkPatches: true },
1243-
]
1239+
{ name: 'package-lock.json', checkPatches: true, manager: 'npm' },
1240+
{ name: 'yarn.lock', checkPatches: true, manager: 'yarn' }, // Included in lockfile for v2+
1241+
{ name: 'pnpm-lock.yaml', checkPatches: false, manager: 'pnpm' }, // Included in lockfile
1242+
{ name: 'bun.lockb', checkPatches: true, manager: 'bun' },
1243+
].sort((_, { manager }) => {
1244+
return process.env.npm_config_user_agent?.startsWith(manager) ? 1 : -1
1245+
})
12441246
const lockfileNames = lockfileFormats.map((l) => l.name)
12451247

12461248
export function getDepHash(config: ResolvedConfig, ssr: boolean): string {

0 commit comments

Comments
 (0)