Issue with sharp optional peer dependency with Payload admin introduced since canary.7 #65247
Labels
bug
Issue was opened via the bug report template.
Module Resolution
Module resolution (CJS / ESM, module resolving)
Runtime
Related to Node.js or Edge Runtime with Next.js.
Link to the code that reproduces this issue
https://github.com/paulpopus/nextjs-payload-sharp-issue
To Reproduce
Ensure that you have
.env
available with the database and payload secret configured, you will need a mongo db running for which you can use a remote DB or the provided docker compose fileThen run
yarn dev
and try to accesslocalhost:3000/admin
.When running nextjs canary version 7 it will work, however newer version of canary have introduced an optional sharp dependency that does not resolve correctly with these package managers and will not work.
So to be clear, change the
package.json
dependency to canary.34 for next and it will break after installing dependencies again.I see this issue happen with yarn v1 and pnpm v8 equally
Current vs. Expected behavior
Current
When accessing
/admin
I see a sharp missing errorExpected
When accessing
/admin
I expect the admin panel to workProvide environment information
Which area(s) are affected? (Select all that apply)
Module Resolution, Runtime
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
"next": "14.3.0-canary.7" works
"next": "14.3.0-canary.34" does not work
canary.7 did not have sharp listed as a dependency and one of the versions since then has introduced it
The text was updated successfully, but these errors were encountered: