100 lines
2.1 KiB
JavaScript
100 lines
2.1 KiB
JavaScript
/**
|
|
* Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation.
|
|
* This is especially useful for Docker builds.
|
|
*/
|
|
|
|
import { env } from "node:process";
|
|
|
|
/** @type {import("next").NextConfig} */
|
|
const nextConfig = {
|
|
compiler: {
|
|
removeConsole: false,
|
|
},
|
|
experimental: {
|
|
// esmExternals: "loose", // This if react-pdf gives compilation issues
|
|
},
|
|
|
|
env: {
|
|
NEXT_PUBLIC_BUILD_ID: Math.random().toString(36).slice(2, 8),
|
|
},
|
|
|
|
devIndicators: false,
|
|
headers: async () => {
|
|
return [
|
|
{
|
|
headers: [
|
|
{
|
|
key: "X-Frame-Options",
|
|
value: "",
|
|
},
|
|
],
|
|
source: "/:path*",
|
|
},
|
|
];
|
|
},
|
|
i18n: {
|
|
defaultLocale: "it",
|
|
locales: ["it", "en"],
|
|
localeDetection: false,
|
|
},
|
|
images: {
|
|
minimumCacheTTL: 7200,
|
|
remotePatterns: [
|
|
{
|
|
hostname: "*.googleusercontent.com",
|
|
pathname: "**",
|
|
port: "",
|
|
protocol: "https",
|
|
},
|
|
{
|
|
hostname: `${env.BACKENDSERVER_URL}`,
|
|
},
|
|
],
|
|
},
|
|
output: env.NODE_ENV === "production" ? "standalone" : undefined, // This is for docker builds
|
|
reactStrictMode: true,
|
|
rewrites: async () => {
|
|
return [
|
|
{
|
|
destination: env.NODE_ENV === "production" ? "/404" : "/api/panel",
|
|
source: "/api/panel",
|
|
},
|
|
{
|
|
destination: `${env.BACKENDSERVER_URL}/images/get/:slug*`,
|
|
source: "/go-api/images/get/:slug*",
|
|
},
|
|
{
|
|
destination: `${env.BACKENDSERVER_URL}/storage/get/:slug*`,
|
|
has: [
|
|
{ key: "access_token", type: "cookie" },
|
|
{
|
|
key: "token",
|
|
type: "query",
|
|
value:
|
|
"(?<token>^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$)",
|
|
},
|
|
],
|
|
source: "/go-api/storage/get/:slug*",
|
|
},
|
|
{
|
|
destination: `${env.BACKENDSERVER_URL}/storage/upload:slug*`,
|
|
has: [
|
|
{ key: "access_token", type: "cookie" },
|
|
{
|
|
key: "token",
|
|
type: "query",
|
|
value:
|
|
"(?<token>^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$)",
|
|
},
|
|
],
|
|
source: "/go-api/storage/upload:slug*",
|
|
},
|
|
];
|
|
},
|
|
|
|
typescript: {
|
|
ignoreBuildErrors: true,
|
|
},
|
|
};
|
|
|
|
export default nextConfig;
|