Files
klz-cables.com/.pnpm-store/v10/files/a9/be64b27460e180bc7ba9a58b11f4e4e264e5be7b94191d28e5f13a37660da90da85943503ffba986ef4ba559f1ec1a3f618b70a7e654f0f61a3ddc68f96fc7
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

47 lines
3.0 KiB
Plaintext

/**
* Applies config options required to support Next.js versions before 16.1.0 and 16.1.0-canary.3.
* @param {import('next').NextConfig} nextConfig
* @returns {import('next').NextConfig}
*/export const withPayloadLegacy = (nextConfig = {}) => {
if (process.env.PAYLOAD_PATCH_TURBOPACK_WARNINGS !== 'false') {
// TODO: This warning is thrown because we cannot externalize the entry-point package for client-s3, so we patch the warning to not show it.
// We can remove this once Next.js implements https://github.com/vercel/next.js/discussions/76991
const turbopackWarningText = 'Packages that should be external need to be installed in the project directory, so they can be resolved from the output files.\nTry to install it into the project directory by running';
// TODO 4.0: Remove this once we drop support for Next.js 15.2.x
const turbopackConfigWarningText = "Unrecognized key(s) in object: 'turbopack'";
const consoleWarn = console.warn;
console.warn = (...args) => {
// Force to disable serverExternalPackages warnings: https://github.com/vercel/next.js/issues/68805
if (typeof args[1] === 'string' && args[1].includes(turbopackWarningText) || typeof args[0] === 'string' && args[0].includes(turbopackWarningText)) {
return;
}
// Add Payload-specific message after turbopack config warning in Next.js 15.2.x or lower.
// TODO 4.0: Remove this once we drop support for Next.js 15.2.x
const hasTurbopackConfigWarning = typeof args[1] === 'string' && args[1].includes(turbopackConfigWarningText) || typeof args[0] === 'string' && args[0].includes(turbopackConfigWarningText);
if (hasTurbopackConfigWarning) {
consoleWarn(...args);
consoleWarn('Payload: You can safely ignore the "Invalid next.config" warning above. This only occurs on Next.js 15.2.x or lower. We recommend upgrading to the latest supported Next.js version to resolve this warning.');
return;
}
consoleWarn(...args);
};
}
const isBuild = process.env.NODE_ENV === 'production';
const isTurbopackNextjs15 = process.env.TURBOPACK === '1';
const isTurbopackNextjs16 = process.env.TURBOPACK === 'auto';
if (isBuild && (isTurbopackNextjs15 || isTurbopackNextjs16)) {
throw new Error('Your Next.js version does not support using Turbopack for production builds. The *minimum* Next.js version required for Turbopack Builds is 16.1.0. Please upgrade to the latest supported Next.js version to resolve this error.');
}
/** @type {import('next').NextConfig} */
const toReturn = {
...nextConfig,
serverExternalPackages: [
// serverExternalPackages = webpack.externals, but with turbopack support and an additional check
// for whether the package is resolvable from the project root
...(nextConfig.serverExternalPackages || []),
// External, because it installs import-in-the-middle and require-in-the-middle - both in the default serverExternalPackages list.
'@sentry/nextjs']
};
return toReturn;
};
//# sourceMappingURL=withPayloadLegacy.js.map