build(config): adjust output and file tracing for Vercel and local compute modes

Update Next.js configuration to conditionally set 'output' only when not on
Vercel, and always define 'outputFileTracingExcludes' with dynamic includes
based on compute mode. This ensures compatibility with Vercel deployments and
improves local/server build behavior.
This commit is contained in:
Richard R 2026-05-20 15:53:26 -06:00
parent 944b8246e5
commit fb32dea73c

View file

@ -21,6 +21,7 @@ const computeMode = computeModeRaw === 'none' || computeModeRaw === 'worker' ||
? computeModeRaw
: 'local';
const computeLocal = computeMode === 'local';
const isVercel = process.env.VERCEL === '1';
const serverExternalPackages = [
'@napi-rs/canvas',
'ffmpeg-static',
@ -29,7 +30,7 @@ const serverExternalPackages = [
];
const nextConfig: NextConfig = {
output: 'standalone',
...(isVercel ? {} : { output: 'standalone' }),
async headers() {
return [
{
@ -66,16 +67,17 @@ const nextConfig: NextConfig = {
'./node_modules/pdfjs-dist/legacy/build/pdf.worker.mjs',
],
},
...(!computeLocal
? {
outputFileTracingExcludes: {
'/*': [
outputFileTracingExcludes: {
'/*': [
'./docstore/**/*',
...(!computeLocal
? [
'./node_modules/onnxruntime-node/**/*',
'./node_modules/@huggingface/tokenizers/**/*',
],
},
}
: {}),
]
: []),
],
},
webpack: (config, { isServer }) => {
if (isServer) {
// Use runtime require to avoid adding an explicit webpack TS dependency.