Files
klz-cables.com/next.config.js
2025-12-28 23:28:31 +01:00

117 lines
2.7 KiB
JavaScript

/** @type {import('next').NextConfig} */
const nextConfig = {
// Enable React Strict Mode for better error detection
reactStrictMode: true,
// Configure images to allow external URLs if needed
images: {
remotePatterns: [
{
protocol: 'https',
hostname: '**',
},
{
protocol: 'http',
hostname: '**',
},
],
unoptimized: true, // Disable image optimization for static export
},
// Enable SWC minification for faster builds
swcMinify: true,
// Configure Sass support
// sassOptions: {
// additionalData: `@use "styles/variables" as *;`,
// },
// Environment variables
env: {
RESEND_API_KEY: process.env.RESEND_API_KEY,
WP_API_URL: process.env.WP_API_URL,
WP_API_USER: process.env.WP_API_USER,
WP_API_PASS: process.env.WP_API_PASS,
SITE_URL: process.env.SITE_URL || 'http://localhost:3000',
},
// Webpack configuration
webpack: (config, { isServer }) => {
// Handle node polyfills if needed
if (!isServer) {
config.resolve.fallback = {
...config.resolve.fallback,
fs: false,
net: false,
tls: false,
};
}
return config;
},
// Generate source maps for better debugging
productionBrowserSourceMaps: false,
// Disable X-Powered-By header for security
poweredByHeader: false,
// Experimental features
experimental: {
// Enable server actions if needed
serverActions: {
bodySizeLimit: '1mb',
},
},
// Output configuration - use 'export' for static sites
// or leave undefined for server-side rendering
output: process.env.NEXT_PUBLIC_EXPORT === 'true' ? 'export' : undefined,
// Base path configuration (if deploying to subdirectory)
basePath: process.env.NEXT_PUBLIC_BASE_PATH || '',
// trailingSlash: true, // Uncomment if you need trailing slashes
// async headers() {
// return [
// {
// source: '/(.*)',
// headers: [
// {
// key: 'X-Frame-Options',
// value: 'DENY',
// },
// {
// key: 'X-Content-Type-Options',
// value: 'nosniff',
// },
// {
// key: 'Referrer-Policy',
// value: 'origin-when-cross-origin',
// },
// ],
// },
// ];
// },
// async redirects() {
// return [
// {
// source: '/old-path',
// destination: '/new-path',
// permanent: true,
// },
// ];
// },
// async rewrites() {
// return {
// beforeFiles: [
// // Rewrites for dynamic routes
// ],
// };
// },
};
module.exports = nextConfig;