diff --git a/packages/next-config/index.js b/packages/next-config/index.js index 56aaa9b..84bc731 100644 --- a/packages/next-config/index.js +++ b/packages/next-config/index.js @@ -8,11 +8,6 @@ import path from "node:path"; export const baseNextConfig = { output: "standalone", turbopack: {}, - experimental: { - serverActions: { - allowedOrigins: ["*.klz-cables.com", "*.branch.klz-cables.com", "localhost:3000", "*.mintel.me"], - }, - }, images: { dangerouslyAllowSVG: true, contentDispositionType: "attachment", @@ -58,6 +53,27 @@ const withMintelConfig = (config) => { let nextConfig = { ...baseNextConfig, ...config }; + // Explicitly merge rewrites + nextConfig.rewrites = async () => { + const defaultRewrites = await baseNextConfig.rewrites(); + let customRewrites = {}; + if (typeof config.rewrites === 'function') { + customRewrites = await config.rewrites(); + } else if (Array.isArray(config.rewrites)) { + customRewrites = config.rewrites; + } + + if (Array.isArray(customRewrites)) { + return [...defaultRewrites, ...customRewrites]; + } + + return { + beforeFiles: [...(customRewrites.beforeFiles || []), ...defaultRewrites], + afterFiles: customRewrites.afterFiles || [], + fallback: customRewrites.fallback || [], + }; + }; + if (hasI18nConfig) { const withNextIntl = createNextIntlPlugin(); nextConfig = withNextIntl(nextConfig); @@ -76,3 +92,4 @@ const withMintelConfig = (config) => { }; export default withMintelConfig; +