Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 21048aa

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

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

‎src/build/content/server.ts‎

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,13 @@ 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+
const filter = ctx.constants.IS_LOCAL ? undefined : nodeModulesFilter
303+
await cp(src, dest, {
304+
recursive: true,
305+
verbatimSymlinks: true,
306+
force: true,
307+
filter,
308+
})
303309

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

‎src/build/plugin-context.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ export interface ExportDetail {
4444
}
4545

4646
export class PluginContext {
47+
constants: NetlifyPluginConstants
4748
featureFlags: NetlifyPluginOptions['featureFlags']
4849
netlifyConfig: NetlifyPluginOptions['netlifyConfig']
4950
pluginName: string
5051
pluginVersion: string
5152
utils: NetlifyPluginUtils
5253

53-
private constants: NetlifyPluginConstants
5454
private packageJSON: { name: string; version: string } & Record<string, unknown>
5555

5656
/** Absolute path of the next runtime plugin directory */

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /