Alternative to upleveled/eslint-config-upleveled#488
Currently, some lifecycle scripts (build scripts) of packages like sharp and bcrypt are not allowed in pnpm v10, and result in errors like the following Ignored build scripts error:
$ pnpm install
Lockfile is up to date, resolution step is skipped
Progress: resolved 1, reused 0, downloaded 0, added 0
Packages: +814
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 814, reused 0, downloaded 69, added 66
...
Ignored build scripts: sharp. Run "pnpm approve-builds" to pick which dependencies should be allowed to run scripts.
Done in 13.8s
A student not including sharp in their Next.js project will mostly appear to work properly, but pages will most likely be slow to load, due to Next.js falling back to slower non-native image optimization.
To avoid this, add a Preflight check to:
- Check
package.json for packages which should be built, like sharp and bcrypt
- Make sure that students have configured the
pnpm.onlyBuiltDependencies correctly (like the example below) for such packages
{
"pnpm": {
"overrides": {
"@emotion/react": "11.14.0",
"@emotion/styled": "11.14.0",
"@tailwindcss/node": "4.0.1",
"@tailwindcss/oxide": "4.0.1",
"@types/react": "19.0.8",
"@types/react-dom": "19.0.3"
},
"patchedDependencies": {
"next": "patches/next.patch"
},
"onlyBuiltDependencies": [
"sharp"
]
}
}
Alternative to upleveled/eslint-config-upleveled#488
Currently, some lifecycle scripts (build scripts) of packages like
sharpandbcryptare not allowed in pnpm v10, and result in errors like the followingIgnored build scriptserror:A student not including
sharpin their Next.js project will mostly appear to work properly, but pages will most likely be slow to load, due to Next.js falling back to slower non-native image optimization.To avoid this, add a Preflight check to:
package.jsonfor packages which should be built, likesharpandbcryptpnpm.onlyBuiltDependenciescorrectly (like the example below) for such packages{ "pnpm": { "overrides": { "@emotion/react": "11.14.0", "@emotion/styled": "11.14.0", "@tailwindcss/node": "4.0.1", "@tailwindcss/oxide": "4.0.1", "@types/react": "19.0.8", "@types/react-dom": "19.0.3" }, "patchedDependencies": { "next": "patches/next.patch" }, "onlyBuiltDependencies": [ "sharp" ] } }