fix: production stabilization (middleware routing + docker paths)
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 7s
Build & Deploy / 🏗️ Build (push) Successful in 12m46s
Build & Deploy / 🚀 Deploy (push) Successful in 20s
Build & Deploy / 🩺 Smoke Test (push) Failing after 3s
Build & Deploy / 🔔 Notify (push) Successful in 7s
Nightly QA / 🔍 Static Analysis (push) Successful in 2m36s
Nightly QA / 🔗 Links & Deps (push) Successful in 2m13s
Nightly QA / 🎭 Lighthouse (push) Successful in 3m47s
Nightly QA / 📝 E2E (push) Successful in 4m28s
Nightly QA / 🔔 Notify (push) Has been skipped
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 7s
Build & Deploy / 🏗️ Build (push) Successful in 12m46s
Build & Deploy / 🚀 Deploy (push) Successful in 20s
Build & Deploy / 🩺 Smoke Test (push) Failing after 3s
Build & Deploy / 🔔 Notify (push) Successful in 7s
Nightly QA / 🔍 Static Analysis (push) Successful in 2m36s
Nightly QA / 🔗 Links & Deps (push) Successful in 2m13s
Nightly QA / 🎭 Lighthouse (push) Successful in 3m47s
Nightly QA / 📝 E2E (push) Successful in 4m28s
Nightly QA / 🔔 Notify (push) Has been skipped
This commit is contained in:
@@ -46,57 +46,12 @@ const nextConfig = {
|
||||
},
|
||||
];
|
||||
},
|
||||
// In Standalone mode, Next.js expects the tracing root to be the monorepo root
|
||||
outputFileTracingRoot: path.join(dirname, '../../'),
|
||||
};
|
||||
|
||||
const withMDX = createMDX({});
|
||||
|
||||
// Execute wrappers
|
||||
let config = withPayload(withMintelConfig(withMDX(nextConfig)));
|
||||
|
||||
/**
|
||||
* Injects our critical showcase rewrites into a resolved Next.js config object.
|
||||
*/
|
||||
function injectShowcaseRewrites(resolvedConfig) {
|
||||
const originalRewrites = resolvedConfig.rewrites;
|
||||
|
||||
resolvedConfig.rewrites = async () => {
|
||||
const existing = await originalRewrites?.() || [];
|
||||
|
||||
// Normalize existing to object pattern
|
||||
const normalized = Array.isArray(existing)
|
||||
? { afterFiles: existing, beforeFiles: [], fallback: [] }
|
||||
: existing;
|
||||
|
||||
return {
|
||||
...normalized,
|
||||
beforeFiles: [
|
||||
...(normalized.beforeFiles || []),
|
||||
// Diagnostic rule
|
||||
{ source: '/robots-test', destination: '/robots.txt' },
|
||||
// Showcase Assets
|
||||
{ source: '/assets/:path*', destination: '/showcase/klz-cables.com/assets/:path*' },
|
||||
{ source: '/wp-content/:path*', destination: '/showcase/klz-cables.com/assets/klz-cables.com/wp-content/:path*' },
|
||||
{ source: '/wp-includes/:path*', destination: '/showcase/klz-cables.com/assets/klz-cables.com/wp-includes/:path*' },
|
||||
{ source: '/:folder(case-studies|work|blog)/assets/:path*', destination: '/showcase/klz-cables.com/assets/:path*' },
|
||||
{ source: '/:folder(case-studies|work|blog)/wp-content/:path*', destination: '/showcase/klz-cables.com/assets/klz-cables.com/wp-content/:path*' },
|
||||
{ source: '/:folder(case-studies|work|blog)/wp-includes/:path*', destination: '/showcase/klz-cables.com/assets/klz-cables.com/wp-includes/:path*' },
|
||||
],
|
||||
};
|
||||
};
|
||||
|
||||
return resolvedConfig;
|
||||
}
|
||||
|
||||
// Handle both standard objects and functional wrappers (like withPayload)
|
||||
if (typeof config === 'function') {
|
||||
const originalConfigWrapper = config;
|
||||
config = async (phase, args) => {
|
||||
const resolved = await originalConfigWrapper(phase, args);
|
||||
return injectShowcaseRewrites(resolved);
|
||||
};
|
||||
} else {
|
||||
config = injectShowcaseRewrites(config);
|
||||
}
|
||||
|
||||
export default config;
|
||||
// Clean, standard wrapper application
|
||||
// Rewrites are now handled by src/middleware.ts for maximum robustness
|
||||
export default withPayload(withMintelConfig(withMDX(nextConfig)));
|
||||
|
||||
Reference in New Issue
Block a user