// Hybrid rendering configuration - Recommended for most projects
// Static pages by default, SSR where needed with `export const prerender = false`

import { defineConfig } from 'astro/config';
import cloudflare from '@astrojs/cloudflare';

export default defineConfig({
  output: 'hybrid',

  adapter: cloudflare({
    // Mode: 'directory' (default) = separate function per route
    //        'standalone' = single worker for all routes
    mode: 'directory',

    // Image service: 'passthrough' (default) or 'compile'
    imageService: 'passthrough',

    // Platform proxy for local development with Cloudflare bindings
    platformProxy: {
      enabled: true,
      configPath: './wrangler.jsonc',
    },
  }),

  // Optional: Add integrations
  // integrations: [
  //   tailwind(),
  //   react(),
  //   sitemap(),
  // ],

  vite: {
    build: {
      chunkSizeWarningLimit: 1000,
    },
  },
});

// Usage: Add to pages that need SSR:
// export const prerender = false;
