hygraph / hygraph-examples

Example projects to help you get started with Hygraph
https://hygraph.com
MIT License
614 stars 159 forks source link

Example doesn't work #181

Closed hillonyechekwa closed 3 years ago

hillonyechekwa commented 3 years ago

I've trying to deploy my next app to netlify but the build kept failing, then I realized that the problem was that npm run export command wasn't working. So I realized It was an issue with the next/image component and nextjs requires a loader function to be included in the next/image when the media is coming from a cloud-like platform like graphcms. Now I followed this example to write a loader but the export still doesn't work. This is what my loader looks like

function gcmsLoader ({ src, width }) {
    const relativeSrc = (src) => src.split('/').pop()

    return `https://media.graphcms.com/resize=width:${width}/${relativeSrc(src)}`
}

although in the next example of the loader, the loader function requires one more parameter and that's the quality parameter but it's not in this example and I'm not sure how to implement that within the code. I'm not sure but maybe that's preventing the app from exporting. I need help with this, please.

notrab commented 3 years ago

Hey

have you looked at https://www.netlify.com/with/nextjs/ to make sure it follows everything Netlify suggests?

notrab commented 3 years ago

Also, can you confirm which Next example you’re trying to use? This repo contains quite a few 😅