Search code examples
wordpressvercel

Vercel build not building images hosted locally


I have a CMS running locally. When running Vercel build & Vercel deploy it does deploy correctly, however when looking at the .vercel directory the images are not being built and will show a 404 not found on the preview link at Vercel.

The images in the public directory are working. The images which are being retrieved from the CMS (which is running locally) are working in development, but not in Production.

I didn't find anything in the documentation or when running vercel build --help.

https://example.vercel.app/_next/image?url=http%3A%2F%2Fnomemoir.local%2Fwp-content%2Fuploads%2F2023%2F03%2FCROONRING_CAMPANGE_LIEVE_1_WEB.jpeg&w=3840&q=100

It makes sense since the domain is linked to an URL that doesn't exist. Is there a workaround for this? Otherwise I have to link the CMS images to the public directory.


Solution

  • Solved this for now by linking the upload/media folder of my CMS to the public folder. I'm using Wordpress on Local. So I went to http://nomemoir.local/wp-admin/options.php page. And changed the upload_path to the pathname of my Nextjs public directory. Also changed the upload URL path to my localhost so I can see a preview of the image in Wordpress. Another solution would be using symlink.

    enter image description here