Use Next.js's dynamic function to import the Map component dynamically. This ensures it's only rendered on the client side.
Implement this if you have encountered window not defined error and if nextjs build fails
import dynamic from "next/dynamic";
const DynamicMap = dynamic(() => import("./Map"), {
loading: () => <p>Loading...</p>,