Skip to content

Nextjs not displaying images github-pages #81259

@Neobii

Description

@Neobii

Link to the code that reproduces this issue

https://github.com/staticStatic/unnuo

To Reproduce

I'm just using npx create-next-app@latest and the next's github deploy to github-pages deploying this, the images don't display on it hosted at the github pages deployment

Current vs. Expected behavior

current

/image

expected

unnuo/image

Provide environment information

github codespaces

Which area(s) are affected? (Select all that apply)

Image (next/image)

Which stage(s) are affected? (Select all that apply)

Other (Deployed)

Additional context

These are the Next changes I've made

import type { NextConfig } from "next";

const isProd = process.env.NODE_ENV;

const nextConfig: NextConfig = {
    basePath: isProd ? '/unnuo' : "",
    assetPrefix: isProd ? '/unnuo' : "",
    output: "export",  // <=== enables static exports
    reactStrictMode: true,
    images: {
    unoptimized: true, // Optional: Use this if you're hosting images statically
  },
};

export default nextConfig;

export default nextConfig;

Metadata

Metadata

Assignees

Labels

Image (next/image)Related to Next.js Image Optimization.

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions