Images that display correctly in the V0 preview often break after exporting because V0's sandbox resolves paths differently than a standard Next.js project. Common causes include referencing images with incorrect paths, missing the /public directory in the export, and using the Next.js Image component without configuring remote image domains. Fix these by placing images in /public, using correct absolute paths, and configuring next.config.js for external image sources.
Why images break after exporting V0 code
V0's preview sandbox uses esm.sh and a virtual file system that resolves image paths flexibly. When you export the code via GitHub integration or ZIP download, those paths must resolve against a real Next.js project structure. Images fail for several reasons: the /public directory may not be included in the export, image paths may reference sandbox-specific URLs, the Next.js Image component requires explicit domain configuration for remote images, and static export mode (output: 'export') requires the unoptimized prop because Image Optimization requires a server.
- Image files from V0's sandbox are not included in the GitHub export or ZIP download
- Paths reference V0-specific URLs like blob: or esm.sh CDN paths that do not exist outside the sandbox
- Next.js Image component blocks remote images from domains not listed in next.config.js
- Static export mode requires images.unoptimized: true because Image Optimization needs a running server
- Case-sensitive file paths on Linux servers do not match the casing used in V0's preview
Error messages you might see
Error: Invalid src prop (https://example.com/image.jpg) on `next/image`, hostname "example.com" is not configured under images in your `next.config.js`The Next.js Image component blocks remote images by default. You must add each external hostname to the images.remotePatterns array in next.config.js.
Error: Image Optimization using the default loader is not compatible with `output: 'export'`.When using static export, the Next.js Image Optimization API is unavailable because it requires a running server. Set images.unoptimized to true in next.config.js.
GET /images/hero.png 404 (Not Found)The image file does not exist in the /public directory of your exported project. V0's sandbox may have served it from a virtual file system that was not included in the export.
Before you start
- A V0 project exported via GitHub integration or ZIP download
- The exported project running locally or deployed to Vercel
- Access to modify next.config.js and the /public directory
How to fix it
Download and place image files in the /public directory
V0's sandbox may serve images from a virtual file system. When you export, those files may not be included. The /public directory in Next.js serves static files at the root path.
Download and place image files in the /public directory
V0's sandbox may serve images from a virtual file system. When you export, those files may not be included. The /public directory in Next.js serves static files at the root path.
Check which images are missing by opening the browser DevTools Network tab and looking for 404 responses. Download the original image files and place them in the /public directory of your exported project. Reference them with absolute paths starting from /.
<Image src="/images/hero.png" alt="Hero" width={800} height={400}/>{/* File does not exist at public/images/hero.png */}<Image src="/images/hero.png" alt="Hero" width={800} height={400}/>{/* File saved to public/images/hero.png */}Expected result: The image loads correctly from the /public/images/ directory.
Configure remote image domains in next.config.js
The Next.js Image component blocks remote images from unauthorized domains for security. V0-generated code often references external image URLs from Unsplash, placeholder services, or CDNs.
Configure remote image domains in next.config.js
The Next.js Image component blocks remote images from unauthorized domains for security. V0-generated code often references external image URLs from Unsplash, placeholder services, or CDNs.
Open next.config.js and add each external image hostname to the images.remotePatterns array.
/** @type {import('next').NextConfig} */const nextConfig = {};module.exports = nextConfig;/** @type {import('next').NextConfig} */const nextConfig = { images: { remotePatterns: [ { protocol: "https", hostname: "images.unsplash.com", }, { protocol: "https", hostname: "via.placeholder.com", }, ], },};module.exports = nextConfig;Expected result: Remote images from configured domains load without the 'hostname is not configured' error.
Enable unoptimized images for static export mode
If your exported project uses output: 'export' for static hosting, the Next.js Image Optimization API is unavailable. Setting unoptimized to true tells the Image component to serve images as-is.
Enable unoptimized images for static export mode
If your exported project uses output: 'export' for static hosting, the Next.js Image Optimization API is unavailable. Setting unoptimized to true tells the Image component to serve images as-is.
Add images.unoptimized: true to next.config.js when using static export.
const nextConfig = { output: 'export',};const nextConfig = { output: 'export', images: { unoptimized: true, },};Expected result: Images render correctly in the static export without the Image Optimization compatibility error.
Replace V0 sandbox-specific image URLs with local or CDN paths
V0 sometimes generates code with blob: URLs or esm.sh-resolved paths that only work inside the V0 sandbox. These URLs are invalid outside the preview environment.
Replace V0 sandbox-specific image URLs with local or CDN paths
V0 sometimes generates code with blob: URLs or esm.sh-resolved paths that only work inside the V0 sandbox. These URLs are invalid outside the preview environment.
Search your exported code for any image src values containing blob:, esm.sh, or v0.dev domains. Replace them with either local /public paths or proper CDN URLs.
<img src="blob:https://v0.dev/abc123-image" alt="Generated"/><Image src="/generated-image.png" alt="Generated" width={400} height={300}/>Expected result: All images reference valid paths that resolve correctly outside the V0 sandbox.
Complete code example
1/** @type {import('next').NextConfig} */2const nextConfig = {3 // Uncomment for static export (Netlify, GitHub Pages, etc.)4 // output: 'export',56 images: {7 // Required when using output: 'export'8 // unoptimized: true,910 // Allow remote images from these domains11 remotePatterns: [12 {13 protocol: "https",14 hostname: "images.unsplash.com",15 },16 {17 protocol: "https",18 hostname: "via.placeholder.com",19 },20 {21 protocol: "https",22 hostname: "avatars.githubusercontent.com",23 },24 ],25 },26};2728module.exports = nextConfig;Best practices to prevent this
- Always check the browser DevTools Network tab for 404 image requests after deploying an exported V0 project
- Place all local images in the /public directory and reference them with absolute paths starting from /
- Add every external image domain to images.remotePatterns in next.config.js before deploying
- Use the Next.js Image component instead of plain img tags for automatic optimization and lazy loading
- Set images.unoptimized to true only when using static export — keep optimization enabled for Vercel deployments
- Verify image file name casing matches exactly, since Linux servers are case-sensitive while macOS and Windows are not
- When exporting via ZIP, verify the /public directory and all its contents are included in the download
Still stuck?
Copy one of these prompts to get a personalized, step-by-step explanation.
I exported my V0 project via GitHub and several images are broken. Some show 404 errors, others show 'hostname is not configured' for the Next.js Image component. How do I fix all image paths and configure next.config.js for my exported project?
Frequently asked questions
Why do images work in the V0 preview but break after exporting?
V0's preview sandbox resolves image paths through a virtual file system and CDN that may not be included in the export. When you run the code locally or deploy it, those paths point to non-existent files. Download the images and place them in your /public directory.
How do I configure the Next.js Image component for external images?
Add each external hostname to the images.remotePatterns array in next.config.js. For example, to allow Unsplash images, add an entry with protocol 'https' and hostname 'images.unsplash.com'.
Do I need to set unoptimized: true for Vercel deployments?
No. Vercel natively supports Next.js Image Optimization. Only set unoptimized: true when using output: 'export' for static hosting platforms that cannot run the optimization server.
How do I find all broken images in my exported V0 project?
Open your deployed site in Chrome, press F12 to open DevTools, go to the Network tab, and filter by Img. Refresh the page and look for any requests with a 404 status. Each 404 indicates a broken image path.
Can RapidDev help fix image and asset issues in exported V0 projects?
Yes. RapidDev can audit your exported V0 project, fix all broken asset paths, configure next.config.js for your specific image sources, and ensure the deployment matches the V0 preview exactly.
Should I use img tags or the Next.js Image component in V0 exports?
Use the Next.js Image component for all images. It provides automatic lazy loading, responsive sizing, and format optimization. Only use plain img tags for SVG icons or images that must bypass optimization.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your issue.
Book a free consultation