import type { NextConfig } from "next";

const nextConfig: NextConfig = {
  /* config options here */
  output: "standalone",
  images: {
    domains: [
      "example.com",
      "anotherdomain.com",
      "satupeta.jatimprov.go.id",
      "demo-maps.trikintech.id",
      "geoserver.jatimprov.go.id",
      "sitr.jatimprov.go.id",
      "192.168.1.45",
      "satupeta.profileimage.studio",
    ],
  },
  webpack: (config, { webpack, isServer }) => {
    config.plugins.push(
      new webpack.NormalModuleReplacementPlugin(
        /@zip\.js\/zip\.js\/lib\/zip-no-worker\.js/,
        "@zip.js/zip.js",
      ),
    );

    // Cesium requires
    if (!isServer) {
      config.resolve.fallback = {
        ...config.resolve.fallback,
        fs: false,
        net: false,
        tls: false,
      };
    }

    return config;
  },
};

export default nextConfig;
