/** @type {import('next').NextConfig} */
const nextConfig = {
  output: "export",            // keep: needed for next export
  trailingSlash: true,
  images: {
    unoptimized: true,         // ✅ needed
  },
  swcMinify: true,             // explicit SWC minify
  // experimental: {
  //   forceSwcTransforms: true,  // use SWC only
  //   modern: true,              // ✅ enable modern build (ES6+ for modern browsers)
  //   polyfillsOptimization: true // ✅ remove unnecessary polyfills
  // },

  async headers() {
    return [
      {
        // ✅ Cache static assets for 1 year
        source: "/:all*(woff2|ttf|eot|otf|jpg|jpeg|png|webp|svg|gif|css|js)",
        headers: [
          { key: "Cache-Control", value: "public, max-age=31536000, immutable" },
        ],
      },
      {
        // ✅ Cache HTML for 10 mins
        source: "/:all*(html)",
        headers: [
          { key: "Cache-Control", value: "public, max-age=600, must-revalidate" },
        ],
      },
    ];
  },
};

module.exports = nextConfig;

// next.config.js
// /** @type {import('next').NextConfig} */
// const nextConfig = {
//   output: 'export', // static HTML export
//   trailingSlash: true,
//   images: {
//     // loader: 'custom', // required by next-image-export-optimizer
//     unoptimized: true, // prevents runtime optimization
//   },
//   transpilePackages: ['next-image-export-optimizer'],
//   env: {
//     nextImageExportOptimizer_imageFolderPath: '/assets/images',
//     nextImageExportOptimizer_exportFolderPath: 'out',
//     nextImageExportOptimizer_quality: '65',
//     nextImageExportOptimizer_storePicturesInWEBP: 'true',
//   },
// };

// module.exports = nextConfig;
