How to fetch only specific media formats in Graphql?

System Information
  • Strapi Version: v4.16.2
  • Operating System: Any
  • Database: Postgres 16
  • Node Version: v18.16.1
  • NPM Version: 9.7.2

My page sizes are very large. With Next.js its providing an alert they are almost 500Kb, and should be below 128Kb.

I took a look at the data and the JSON Next.js includes with the page is huge, and its mostly all the image formats. I have large, medium, small and thumbnail data all included on my HTML page, when I only need small.

I supposed I could process the data before outputting it, but ideally I would not want to fetch all the unneeded data from Strapi Graphql in the first place.

If I try to fetch formats { small {…} } it says:
"Field \"formats\" must not have a selection since type \"JSON\" has no subfields."

So basically formats has no subfields I can fetch, I can only fetch formats which returns all of them.

Does anyone know a way to fetch only small for example? I do not want to disable the other formats in Strapi itself because some pages would need small and others may need the large.

Thanks