forked from lobehub/lobehub
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.ts
More file actions
37 lines (33 loc) · 1.18 KB
/
next.config.ts
File metadata and controls
37 lines (33 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { defineConfig } from './src/libs/next/config/define-config';
const isVercel = !!process.env.VERCEL_ENV;
const nextConfig = defineConfig({
// Vercel serverless optimization: exclude musl binaries and ffmpeg from all routes
// Vercel uses Amazon Linux (glibc), not Alpine Linux (musl)
// ffmpeg-static (~76MB) is only needed by /api/webhooks/video/* route
// This saves ~120MB (29MB canvas-musl + 16MB sharp-musl + 76MB ffmpeg)
outputFileTracingExcludes: isVercel
? {
'*': [
'node_modules/.pnpm/@napi-rs+canvas-*-musl*',
'node_modules/.pnpm/@img+sharp-libvips-*musl*',
'node_modules/ffmpeg-static/**',
'node_modules/.pnpm/ffmpeg-static*/**',
],
}
: undefined,
// Include ffmpeg binary only for video webhook processing
// refs: https://github.com/vercel-labs/ffmpeg-on-vercel
outputFileTracingIncludes: isVercel
? {
'/api/webhooks/video/*': ['./node_modules/ffmpeg-static/ffmpeg'],
}
: undefined,
webpack: (webpackConfig, context) => {
const { dev } = context;
if (!dev) {
webpackConfig.cache = false;
}
return webpackConfig;
},
});
export default nextConfig;