| | const jssConfig = require("./src/temp/config"); |
| | const { getPublicUrl } = require("@sitecore-jss/sitecore-jss-nextjs"); |
| | const plugins = require("./src/temp/next-config-plugins") || {}; |
| |
|
| | const publicUrl = getPublicUrl(); |
| |
|
| | |
| | |
| | |
| | const nextConfig = { |
| | |
| | assetPrefix: publicUrl, |
| |
|
| | |
| | distDir: process.env.NEXTJS_DIST_DIR || ".next", |
| |
|
| | |
| | env: { |
| | PUBLIC_URL: publicUrl, |
| | }, |
| |
|
| | i18n: { |
| | |
| | |
| | locales: ["en"], |
| | |
| | |
| | defaultLocale: jssConfig.defaultLanguage, |
| | }, |
| |
|
| | |
| | reactStrictMode: true, |
| |
|
| | async rewrites() { |
| | |
| | return [ |
| | |
| | { |
| | source: "/sitecore/api/:path*", |
| | destination: `${jssConfig.sitecoreApiHost}/sitecore/api/:path*`, |
| | }, |
| | |
| | { |
| | source: "/-/:path*", |
| | destination: `${jssConfig.sitecoreApiHost}/-/:path*`, |
| | }, |
| | |
| | { |
| | source: "/layouts/system/:path*", |
| | destination: `${jssConfig.sitecoreApiHost}/layouts/system/:path*`, |
| | }, |
| | |
| | { |
| | source: "/healthz", |
| | destination: "/api/healthz", |
| | }, |
| | |
| | { |
| | source: "/sitecore/service/:path*", |
| | destination: `${jssConfig.sitecoreApiHost}/sitecore/service/:path*`, |
| | }, |
| | ]; |
| | }, |
| | }; |
| |
|
| | module.exports = () => { |
| | |
| | return Object.values(plugins).reduce( |
| | (acc, plugin) => plugin(acc), |
| | nextConfig, |
| | ); |
| | }; |
| |
|