diff --git a/packages/next/src/lib/patch-incorrect-lockfile.ts b/packages/next/src/lib/patch-incorrect-lockfile.ts index bee374d8d90d5..b7678884f7fed 100644 --- a/packages/next/src/lib/patch-incorrect-lockfile.ts +++ b/packages/next/src/lib/patch-incorrect-lockfile.ts @@ -56,7 +56,9 @@ export async function patchIncorrectLockfile(dir: string) { const lockfileParsed = JSON.parse(content) const lockfileVersion = parseInt(lockfileParsed?.lockfileVersion, 10) - const expectedSwcPkgs = Object.keys(nextPkgJson['optionalDependencies'] || {}) + const expectedSwcPkgs = Object.keys( + nextPkgJson['optionalDependencies'] || {} + ).filter((pkg) => pkg.startsWith('@next/swc-')) const patchDependency = ( pkg: string,