Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
0bded2db
Unverified
Commit
0bded2db
authored
Jun 08, 2026
by
Sebastian "Sebbie" Silbermann
Committed by
GitHub
Jun 08, 2026
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[cna] Use `allowBuilds` instead of `ignoredBuiltDependencies` when using PNPM 11+ (#94544)
parent
f5718d2c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
2 deletions
+71
-2
index.ts
packages/create-next-app/templates/index.ts
+20
-1
pnpm.test.ts
test/production/create-next-app/package-manager/pnpm.test.ts
+51
-1
No files found.
packages/create-next-app/templates/index.ts
View file @
0bded2db
...
...
@@ -338,7 +338,26 @@ export const installTemplate = async ({
// If we can't determine the version, assume latest (v10+) since we already
// know pnpm is being used at this point.
const
pnpmMajorVersion
=
getPnpmMajorVersion
();
if
(
pnpmMajorVersion
===
null
||
pnpmMajorVersion
>=
10
)
{
if
(
pnpmMajorVersion
===
null
||
pnpmMajorVersion
>=
11
)
{
// In pnpm v11, `ignoredBuiltDependencies` (and the other build-script
// settings) were removed in favor of a single `allowBuilds` map where
// `false` denies a package from running build scripts. See
// https://pnpm.io/blog/releases/11.0
const
pnpmWorkspaceYaml
=
[
"allowBuilds:"
,
// Sharp has prebuilt binaries for the platforms next-swc has binaries.
// If it needs to build binaries from source, next-swc wouldn't work either.
// See https://sharp.pixelplumbing.com/install/#:~:text=When%20using%20pnpm%2C%20add%20sharp%20to%20ignoredBuiltDependencies%20to%20silence%20warnings
" sharp: false"
,
// Not needed for pnpm: https://github.com/unrs/unrs-resolver/issues/193#issuecomment-3295510146
" unrs-resolver: false"
,
""
,
].
join
(
os
.
EOL
);
await
fs
.
writeFile
(
path
.
join
(
root
,
"pnpm-workspace.yaml"
),
pnpmWorkspaceYaml
,
);
}
else
if
(
pnpmMajorVersion
>=
10
)
{
const
pnpmWorkspaceYaml
=
[
"ignoredBuiltDependencies:"
,
// Sharp has prebuilt binaries for the platforms next-swc has binaries.
...
...
test/production/create-next-app/package-manager/pnpm.test.ts
View file @
0bded2db
import
fs
from
'fs'
import
path
from
'path'
import
{
command
,
DEFAULT_FILES
,
...
...
@@ -91,7 +93,7 @@ describe('create-next-app with package manager pnpm', () => {
// 1. We only need to verify the workspace file is created/not created
// 2. The CI runs pnpm v9, but when testing v10 behavior, the workspace file
// created for v10 (without packages field) would fail with pnpm v9
it
(
'should create pnpm-workspace.yaml
for pnpm v10+
'
,
async
()
=>
{
it
(
'should create pnpm-workspace.yaml
with ignoredBuiltDependencies for pnpm v10
'
,
async
()
=>
{
await
useTempDir
(
async
(
cwd
)
=>
{
const
projectName
=
'pnpm-v10-workspace'
const
res
=
await
run
(
...
...
@@ -120,6 +122,54 @@ describe('create-next-app with package manager pnpm', () => {
projectName
,
files
:
[
'package.json'
,
'pnpm-workspace.yaml'
],
})
const
workspaceYaml
=
fs
.
readFileSync
(
path
.
join
(
cwd
,
projectName
,
'pnpm-workspace.yaml'
),
'utf8'
)
expect
(
workspaceYaml
).
toContain
(
'ignoredBuiltDependencies:'
)
expect
(
workspaceYaml
).
toContain
(
'- sharp'
)
expect
(
workspaceYaml
).
toContain
(
'- unrs-resolver'
)
expect
(
workspaceYaml
).
not
.
toContain
(
'allowBuilds:'
)
})
})
it
(
'should create pnpm-workspace.yaml with allowBuilds for pnpm v11+'
,
async
()
=>
{
await
useTempDir
(
async
(
cwd
)
=>
{
const
projectName
=
'pnpm-v11-workspace'
const
res
=
await
run
(
[
projectName
,
'--ts'
,
'--app'
,
'--no-linter'
,
'--no-src-dir'
,
'--no-tailwind'
,
'--no-import-alias'
,
'--no-react-compiler'
,
'--no-agents-md'
,
'--skip-install'
,
],
nextTgzFilename
,
{
cwd
,
env
:
{
npm_config_user_agent
:
'pnpm/11.0.0 npm/? node/v20.0.0'
},
}
)
expect
(
res
.
exitCode
).
toBe
(
0
)
projectFilesShouldExist
({
cwd
,
projectName
,
files
:
[
'package.json'
,
'pnpm-workspace.yaml'
],
})
const
workspaceYaml
=
fs
.
readFileSync
(
path
.
join
(
cwd
,
projectName
,
'pnpm-workspace.yaml'
),
'utf8'
)
expect
(
workspaceYaml
).
toContain
(
'allowBuilds:'
)
expect
(
workspaceYaml
).
toContain
(
'sharp: false'
)
expect
(
workspaceYaml
).
toContain
(
'unrs-resolver: false'
)
expect
(
workspaceYaml
).
not
.
toContain
(
'ignoredBuiltDependencies:'
)
})
})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment