Files
lobehub/next.config.ts
2026-01-24 18:04:45 +08:00

32 lines
822 B
TypeScript

import { defineConfig } from './src/libs/next/config/define-config';
const isVercel = !!process.env.VERCEL_ENV;
const nextConfig = defineConfig({
experimental: {
webpackBuildWorker: true,
webpackMemoryOptimizations: true,
},
// Vercel serverless optimization: exclude musl binaries
// Vercel uses Amazon Linux (glibc), not Alpine Linux (musl)
// This saves ~45MB (29MB canvas-musl + 16MB sharp-musl)
outputFileTracingExcludes: isVercel
? {
'*': [
'node_modules/.pnpm/@napi-rs+canvas-*-musl*',
'node_modules/.pnpm/@img+sharp-libvips-*musl*',
],
}
: undefined,
webpack: (webpackConfig, context) => {
const { dev } = context;
if (!dev) {
webpackConfig.cache = false;
}
return webpackConfig;
},
});
export default nextConfig;