47 lines
1.9 KiB
TypeScript
47 lines
1.9 KiB
TypeScript
import type { NextConfig } from "next";
|
|
import createNextIntlPlugin from "next-intl/plugin";
|
|
import withSerwistInit from "@serwist/next";
|
|
|
|
// Serwist baut den Service Worker aus app/sw.ts nach public/sw.js.
|
|
// In der Entwicklung aus: Ein Service Worker, der alte Stände ausliefert,
|
|
// macht jedes Neuladen zur Rätselfrage.
|
|
const withSerwist = withSerwistInit({
|
|
swSrc: "app/sw.ts",
|
|
swDest: "public/sw.js",
|
|
disable: process.env.NODE_ENV !== "production",
|
|
// Die Offline-Seite liegt vorab im Cache (Fallback in app/sw.ts).
|
|
additionalPrecacheEntries: [{ url: "/offline", revision: String(Date.now()) }],
|
|
});
|
|
|
|
const withNextIntl = createNextIntlPlugin("./i18n/request.ts");
|
|
|
|
const nextConfig: NextConfig = {
|
|
reactStrictMode: true,
|
|
// Standalone: Das Abbild trägt nur, was zur Laufzeit gebraucht wird.
|
|
output: "standalone",
|
|
// pg lädt optionale Module dynamisch; nicht bündeln, sondern als Paket
|
|
// mitnehmen (standalone verfolgt es dann selbst).
|
|
serverExternalPackages: ["pg"],
|
|
// Das Startbild (app/startbild) liest Poppins und Caveat zur Laufzeit von der
|
|
// Platte; standalone nimmt sie nur mit, wenn sie hier stehen.
|
|
outputFileTracingIncludes: { "/startbild/[size]": ["./lib/brand-fonts/*.woff"] },
|
|
poweredByHeader: false,
|
|
// Kein X-Frame-Options/frame-ancestors: Olares zeigt Apps im eigenen
|
|
// Fenster der Oberfläche. Passkeys sind in fremden Rahmen ohnehin gesperrt.
|
|
async headers() {
|
|
return [
|
|
{
|
|
source: "/:path*",
|
|
headers: [
|
|
{ key: "X-Content-Type-Options", value: "nosniff" },
|
|
{ key: "Referrer-Policy", value: "same-origin" },
|
|
{ key: "Permissions-Policy", value: "camera=(self), microphone=(self), geolocation=(), payment=()" },
|
|
],
|
|
},
|
|
{ source: "/sw.js", headers: [{ key: "Cache-Control", value: "no-cache" }] },
|
|
];
|
|
},
|
|
};
|
|
|
|
export default withSerwist(withNextIntl(nextConfig));
|