fix(next-config): merge custom rewrites properly instead of overriding
All checks were successful
Monorepo Pipeline / ⚡ Prioritize Release (push) Successful in 2s
Monorepo Pipeline / 🧪 Test (push) Successful in 1m7s
Monorepo Pipeline / 🏗️ Build (push) Successful in 3m2s
Monorepo Pipeline / 🧹 Lint (push) Successful in 3m13s
Monorepo Pipeline / 🚀 Release (push) Has been skipped
Monorepo Pipeline / 🐳 Build Gatekeeper (Product) (push) Has been skipped
Monorepo Pipeline / 🐳 Build Build-Base (push) Has been skipped
Monorepo Pipeline / 🐳 Build Production Runtime (push) Has been skipped
All checks were successful
Monorepo Pipeline / ⚡ Prioritize Release (push) Successful in 2s
Monorepo Pipeline / 🧪 Test (push) Successful in 1m7s
Monorepo Pipeline / 🏗️ Build (push) Successful in 3m2s
Monorepo Pipeline / 🧹 Lint (push) Successful in 3m13s
Monorepo Pipeline / 🚀 Release (push) Has been skipped
Monorepo Pipeline / 🐳 Build Gatekeeper (Product) (push) Has been skipped
Monorepo Pipeline / 🐳 Build Build-Base (push) Has been skipped
Monorepo Pipeline / 🐳 Build Production Runtime (push) Has been skipped
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user