Skip to content

Commit ac81308

Browse files
committed
fix: patch upstream pnpm issue
1 parent 0c0a293 commit ac81308

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

src/build/content/server.ts

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,12 @@ export const copyNextDependencies = async (ctx: PluginContext): Promise<void> =>
299299
}
300300
const src = join(ctx.standaloneDir, entry)
301301
const dest = join(ctx.serverHandlerDir, entry)
302-
await cp(src, dest, { recursive: true, verbatimSymlinks: true, force: true })
302+
await cp(src, dest, {
303+
recursive: true,
304+
verbatimSymlinks: true,
305+
force: true,
306+
filter: nodeModulesFilter,
307+
})
303308

304309
if (entry === 'node_modules') {
305310
await recreateNodeModuleSymlinks(ctx.resolveFromSiteDir('node_modules'), dest)
@@ -438,3 +443,21 @@ export const verifyHandlerDirStructure = async (ctx: PluginContext) => {
438443
)
439444
}
440445
}
446+
447+
// This is a workaround for Next.js installations in a pnpm+glibc context
448+
// Patch required due to an intermittent upstream issue in the npm/pnpm ecosystem
449+
// https://github.com/pnpm/pnpm/issues/9654
450+
// https://github.com/pnpm/pnpm/issues/5928
451+
// https://github.com/pnpm/pnpm/issues/7362 (persisting even though ticket is closed)
452+
const nodeModulesFilter = async (sourcePath: string) => {
453+
// Filtering rule for the following packages:
454+
// - @rspack+binding-linux-x64-musl
455+
// - @swc+core-linux-x64-musl
456+
// - @img+sharp-linuxmusl-x64
457+
// - @img+sharp-libvips-linuxmusl-x64
458+
if (sourcePath.includes('linuxmusl-x64') || sourcePath.includes('linux-x64-musl')) {
459+
return false
460+
}
461+
462+
return true
463+
}

0 commit comments

Comments
 (0)