Ecmascript file had an error
18 | });
19 |
> 20 | export const metadata: Metadata = {
| ^^^^^^^^
21 | title: "RblxWork",
22 | description:
23 | "Test.",
You are attempting to export "metadata" from a component marked with "use client", which is disallowed. Either remove the export, or the "use client" directive. Read more: https://nextjs.org/docs/app/api-reference/directives/use-client
ROOT CAUSE:
NavigationLabelsList.tsx(Using "use client")
"use client"
import { usePathname } from "next/navigation";
import { NavigationLabel } from "../WebNavigation/NavigationLabel";
import { useMemo } from "react";
export default function NavigationLabelsList() {
const pathName = usePathname();
const isHidden = useMemo(() => pathName === "/sign-up" || pathName === "/login", [pathName]);
return isHidden ? null : (
<div className="w-auto h-16 flex items-center space-x-10">
<NavigationLabel href="/about">Why RblxWork</NavigationLabel>
<NavigationLabel href="/talent">Find Talent</NavigationLabel>
<NavigationLabel href="/job-listing">Find Work</NavigationLabel>
<NavigationLabel href="/news">What's new</NavigationLabel>
<NavigationLabel href="/plan">Pricing</NavigationLabel>
<NavigationLabel href="/dashboard">Dashboard</NavigationLabel>
</div>
)
}
WHERE ERROR OCCURS: (Server Component)
import type { Metadata } from "next";
import localFont from "next/font/local";
import "./globals.css";
import RblxWorkFooter from "@/UI/Components/RootLayout/RblxWorkFooter";
import RblxWorkNavigation from "@/UI/Components/RootLayout/RblxWorkNavigation";
export const avenirRegular = localFont({
src: "./Fonts/AvenirLTStd-Medium.woff2",
weight: "400", // Regular weight
display: "swap",
});
export const avenirBold = localFont({
src: "./Fonts/AvenirLTStd-Heavy.woff2",
weight: "700", // Bold weight
display: "swap",
});
export const metadata: Metadata = {
title: "RblxWork",
description:
"Test",
icons: "/Website Resources/Favicon/logo.ico",
};
export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en">
<body className={`${avenirRegular.className} antialiased`}>
<RblxWorkNavigation />
{children}
<RblxWorkFooter />
</body>
</html>
);
}