Prmbr/next.config.ts
2025-08-02 23:27:28 +08:00

57 lines
1.3 KiB
TypeScript

import type { NextConfig } from "next";
import createNextIntlPlugin from 'next-intl/plugin';
const withNextIntl = createNextIntlPlugin('./src/i18n/config.ts');
const nextConfig: NextConfig = {
// Cloudflare Workers configuration
experimental: {
serverComponentsExternalPackages: ['@prisma/client'],
},
images: {
// Disable Image Optimization API for Workers compatibility
unoptimized: true,
remotePatterns: [
{
protocol: 'https',
hostname: 'lh3.googleusercontent.com',
port: '',
pathname: '/**',
},
{
protocol: 'https',
hostname: 'avatars.githubusercontent.com',
port: '',
pathname: '/**',
},
{
protocol: 'https',
hostname: '*.supabase.co',
port: '',
pathname: '/**',
},
{
protocol: 'https',
hostname: '*.r2.cloudflarestorage.com',
port: '',
pathname: '/**',
}
],
},
// Webpack configuration for Workers compatibility
webpack: (config, { isServer }) => {
if (isServer) {
// Exclude Node.js specific modules
config.externals.push({
'utf-8-validate': 'commonjs utf-8-validate',
'bufferutil': 'commonjs bufferutil',
});
}
return config;
},
};
export default withNextIntl(nextConfig);