You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

NextJS 13部署GitHub Pages后Safari路由切换图片加载404问题

NextJS 13部署GitHub Pages后Safari路由切换图片404问题

问题现象

将简易NextJS 13站点部署到GitHub Pages后,仅在Safari(iOS及MacOS)出现异常:初始加载时图片显示正常,但路由切换后图片返回404错误。

Safari异常演示

异常演示

Chrome正常演示

正常演示

相关信息

  • GitHub仓库地址:github.com/ayush-lal/boilerplate-nextjs
  • 当前next.config.js配置代码:
// next.config.js

/** @type {import('next').NextConfig} */

const repo = "boilerplate-nextjs";
const assetPrefix = `/${repo}/`;
const basePath = `/${repo}`;

const nextConfig = {
  trailingSlash: true,

  output: "export",
  basePath: basePath,
  assetPrefix: assetPrefix,
  images: {
    unoptimized: true,
  },
};

module.exports = nextConfig;

内容的提问来源于stack exchange,提问作者ayush

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.21 22:34:55