2025-02-14 11:48:36 +01:00
|
|
|
import { fileURLToPath } from 'url'
|
|
|
|
|
import { dirname, join } from 'path'
|
2026-05-31 12:41:10 +02:00
|
|
|
import createNextIntlPlugin from 'next-intl/plugin'
|
2025-02-14 11:48:36 +01:00
|
|
|
|
|
|
|
|
const __filename = fileURLToPath(import.meta.url)
|
|
|
|
|
const __dirname = dirname(__filename)
|
|
|
|
|
|
2026-05-31 12:41:10 +02:00
|
|
|
// Wires the next-intl request config at ./i18n/request.ts into the
|
|
|
|
|
// Next.js build. Every page rendered under /[locale]/... gets the
|
|
|
|
|
// per-request messages and locale resolution from there.
|
|
|
|
|
const withNextIntl = createNextIntlPlugin('./i18n/request.ts')
|
2025-12-13 19:09:26 +01:00
|
|
|
|
2025-02-13 23:04:40 +01:00
|
|
|
/** @type {import('next').NextConfig} */
|
|
|
|
|
const nextConfig = {
|
2025-02-14 11:44:56 +01:00
|
|
|
output: "export",
|
Hotfix: trailingSlash:true so GitHub Pages serves the locale roots
The previous deploy went live but every visitor hit a 404. Root cause:
GitHub Pages serves the URL `/foo/` by looking for `out/foo/index.html`.
Next.js's static export with the default `trailingSlash: false` instead
emits `out/foo.html`, which Pages only serves for `/foo` (no trailing
slash).
The i18n root redirect in app/page.tsx points users at
`/<defaultLocale>/` (with slash) because that is what next-intl's
`<Link>` components generate. So every visitor landed on
`https://proxmenux.com/en/` → Pages looked for `out/en/index.html`,
did not find it (the export had emitted `out/en.html`), and fell back
to `out/404.html`. Result: the site looked deployed but every page
was a Next.js 404 template.
Setting `trailingSlash: true` makes the export emit
`out/<route>/index.html` for every page — locale roots
(`out/en/index.html`, `out/es/index.html`), nested doc pages
(`out/en/docs/monitor/dashboard/settings/index.html`, etc.), changelog,
guides — so Pages serves them directly.
Local verification: 232 pages built, root redirect intact at
out/index.html, and every locale + doc + guide URL now resolves to
its own index.html.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-31 13:48:21 +02:00
|
|
|
// GitHub Pages serves a directory URL `/foo/` by looking for
|
|
|
|
|
// `out/foo/index.html`. Next.js's default static export with
|
|
|
|
|
// `trailingSlash: false` emits `out/foo.html` instead, which Pages
|
|
|
|
|
// only serves for the bare URL `/foo` (no trailing slash). The
|
|
|
|
|
// i18n root redirect points users at `/<defaultLocale>/` (with
|
|
|
|
|
// slash) — so every visitor would land on a 404. Enabling
|
|
|
|
|
// trailingSlash makes Next.js emit `out/<route>/index.html` for
|
|
|
|
|
// every page, including `out/en/index.html` and `out/es/index.html`
|
|
|
|
|
// so the locale roots load correctly. Internal `<Link>` URLs from
|
|
|
|
|
// next-intl already include the trailing slash, so this aligns
|
|
|
|
|
// export, runtime navigation and Pages serving.
|
|
|
|
|
trailingSlash: true,
|
2025-12-13 19:09:26 +01:00
|
|
|
eslint: {
|
|
|
|
|
ignoreDuringBuilds: true,
|
|
|
|
|
},
|
|
|
|
|
typescript: {
|
|
|
|
|
ignoreBuildErrors: true,
|
|
|
|
|
},
|
2025-02-13 23:04:40 +01:00
|
|
|
images: {
|
|
|
|
|
unoptimized: true,
|
2025-02-15 16:38:45 +01:00
|
|
|
remotePatterns: [
|
|
|
|
|
{
|
|
|
|
|
protocol: "https",
|
|
|
|
|
hostname: "raw.githubusercontent.com",
|
|
|
|
|
pathname: "/MacRimi/ProxMenux/main/images/**",
|
|
|
|
|
},
|
|
|
|
|
],
|
2025-02-13 23:04:40 +01:00
|
|
|
},
|
2025-02-14 11:48:36 +01:00
|
|
|
staticPageGenerationTimeout: 180,
|
2025-02-14 11:44:56 +01:00
|
|
|
webpack: (config, { isServer }) => {
|
2025-02-14 11:48:36 +01:00
|
|
|
config.resolve.alias["@guides"] = join(__dirname, "..", "guides")
|
|
|
|
|
config.resolve.alias["@changelog"] = join(__dirname, "..", "CHANGELOG.md")
|
2025-02-14 11:44:56 +01:00
|
|
|
return config
|
2025-02-13 23:04:40 +01:00
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-31 12:41:10 +02:00
|
|
|
export default withNextIntl(nextConfig)
|