Skip to content

Commit

Permalink
fix(optimizer): load the correct lock file (#12700)
Browse files Browse the repository at this point in the history
  • Loading branch information
sun0day committed Apr 4, 2023
1 parent e6eed85 commit 889eebe
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/vite/src/node/optimizer/index.ts
Expand Up @@ -1236,11 +1236,13 @@ function isSingleDefaultExport(exports: readonly string[]) {
}

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

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

0 comments on commit 889eebe

Please sign in to comment.