Next.js Discord

Discord Forum

Should you install Sharp package when next/image exists?

Answered
Reddish carpenter ant posted this in #help-forum
Open in Discord
Reddish carpenter antOP
So I had a pull request adding this package https://www.npmjs.com/package/sharp but I'm not sure its needed in a nextjs app, considering we have next/image to do that for you
Answered by joulev
Hosted on Vercel? No.
Self-hosting? Pretty sure during build there is a warning telling you to install sharp if you don’t have it installed. If you see the warning, install it. If not, no need.
View full answer

7 Replies

@Reddish carpenter ant So I had a pull request adding this package https://www.npmjs.com/package/sharp but I'm not sure its needed in a nextjs app, considering we have next/image to do that for you
Hosted on Vercel? No.
Self-hosting? Pretty sure during build there is a warning telling you to install sharp if you don’t have it installed. If you see the warning, install it. If not, no need.
Answer
Reddish carpenter antOP
Fair enough, so it doesn't really matter if its installed or not - (unless its sefl-hosted then it shuld be but..). I guess they must have had that error then if they installed it, as first time I see this, but then I always hosted on vercel
@Reddish carpenter ant Fair enough, so it doesn't really matter if its installed or not - (unless its sefl-hosted then it shuld be but..). I guess they must have had that error then if they installed it, as first time I see this, but then I always hosted on vercel
If you run next build then next start, it also counts as self hosting and at least in the past, the error did show up in this scenario. Some changes are made about next/image recently regarding sharp so idk if the error is still there
Reddish carpenter antOP
Interesting, I never had that error, but maybe I don't remember it. I used NextJS in 2020/2021 and then started using NextJS 13 only a few months back
It was more like a warning than an error, and it doesn’t break anything so often goes ignored yeah. I myself saw the warning a lot but never cared
Reddish carpenter antOP
Interesting 😄 Alright, fair enough thanks for the insights about this! 🙂