Files
web/next.config.js
Christel Westerberg 7710d3f8f9 fix: make summary sticky
2024-10-30 15:51:04 +01:00

173 lines
4.6 KiB
JavaScript

import createJiti from "jiti"
import { fileURLToPath } from "url"
import { login, logout } from "./constants/routes/handleAuth.js"
import { hotelReservation } from "./constants/routes/hotelReservation.js"
import { myPages } from "./constants/routes/myPages.js"
const path = fileURLToPath(new URL(import.meta.url))
const jiti = createJiti(path)
jiti("./env/server")
jiti("./env/client")
/** @type {import('next').NextConfig} */
const nextConfig = {
poweredByHeader: false,
eslint: { ignoreDuringBuilds: true },
trailingSlash: false,
experimental: {
instrumentationHook: true,
serverActions: {
allowedOrigins: [
"*--web-scandic-hotels.netlify.app",
"develop--web-scandic-hotels.netlify.app",
"stage--web-scandic-hotels.netlify.app",
"test--web-scandic-hotels.netlify.app",
"master--web-scandic-hotels.netlify.app",
"*.scandichotels.com",
],
},
},
images: {
remotePatterns: [
{
protocol: "https",
hostname: "eu-images.contentstack.com",
pathname: "/v3/assets/**",
},
{
protocol: "https",
hostname: "scandichotels.com",
},
{
protocol: "https",
hostname: "*.scandichotels.com",
},
],
},
logging: {
fetches: {
fullUrl: true,
},
},
output: "standalone",
webpack: function (config, options) {
config.module.rules.push(
{
test: /\.(graphql|gql)/,
exclude: /node_modules/,
loader: "graphql-tag/loader",
},
{
test: /\.svg$/,
use: ["@svgr/webpack"],
}
)
return config
},
// https://nextjs.org/docs/app/api-reference/next-config-js/redirects#header-cookie-and-query-matching
redirects() {
return [
// {
// ----------------------------------------
// Uncomment when Team Explorer has deployed
// the select room submission
// ----------------------------------------
// source: "/:lang/hotelreservation/(select-bed|breakfast|details|payment)",
// destination: "/:lang/hotelreservation/select-rate",
// missing: [
// {
// key: "hotel",
// type: "query",
// value: undefined,
// },
// {
// key: "fromDate",
// type: "query",
// value: undefined,
// },
// {
// key: "toDate",
// type: "query",
// value: undefined,
// },
// {
// key: "room",
// type: "query",
// value: undefined,
// },
// ],
// permanent: false,
// },
]
},
rewrites() {
return {
beforeFiles: [
{ source: login.da, destination: "/da/login" },
{ source: login.de, destination: "/de/login" },
{ source: login.fi, destination: "/fi/login" },
{ source: login.no, destination: "/no/login" },
{ source: login.sv, destination: "/sv/login" },
{ source: logout.da, destination: "/da/logout" },
{ source: logout.de, destination: "/de/logout" },
{ source: logout.fi, destination: "/fi/logout" },
{ source: logout.no, destination: "/no/logout" },
{ source: logout.sv, destination: "/sv/logout" },
{
source: `${myPages.en}/:path*`,
destination: `/en/my-pages/:path*`,
},
{
source: `${myPages.da}/:path*`,
destination: `/da/my-pages/:path*`,
},
{
source: `${myPages.de}/:path*`,
destination: `/de/my-pages/:path*`,
},
{
source: `${myPages.fi}/:path*`,
destination: `/fi/my-pages/:path*`,
},
{
source: `${myPages.no}/:path*`,
destination: `/no/my-pages/:path*`,
},
{
source: `${myPages.sv}/:path*`,
destination: `/sv/my-pages/:path*`,
},
{
source: `${hotelReservation.da}/:path*`,
destination: "/da/hotelreservation/:path*",
},
{
source: `${hotelReservation.de}/:path*`,
destination: "/de/hotelreservation/:path*",
},
{
source: `${hotelReservation.fi}/:path*`,
destination: "/fi/hotelreservation/:path*",
},
{
source: `${hotelReservation.no}/:path*`,
destination: "/no/hotelreservation/:path*",
},
{
source: `${hotelReservation.sv}/:path*`,
destination: "/sv/hotelreservation/:path*",
},
],
}
},
}
export default nextConfig