<Head>
(next/Head) throwing error
#36277
-
I am trying to add Code: import Head from 'next/head';
export default function Header(props) {
return (
<>
<Head>
<title>Page title</title>
</Head>
{/* some HTMl code */}
</>
)
} Error:
I am sure that the error is in the |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Hello! Could you share a link to your repository? Or a least the content of the file?
|
Beta Was this translation helpful? Give feedback.
-
There isn't much code written. All of the pages I have added head are giving the same error. I am sharing the smallest code block for better readability. One thing I noticed is that if I comment out import Layout from '../../components/layout/layout';
import Head from 'next/head';
export default function Usage() {
return (
<div className="row row-cols-2 row-cols-lg-5">
<Head>
<title>Usage & Metrics</title>
<meta charSet='utf-8' />
<meta name='viewport' content='initial-scale=1.0, width=device-width' />
</Head>
</div>
)
}
Usage.getLayout = function getLayout(page) {
return (<Layout>{page}</Layout>)
} |
Beta Was this translation helpful? Give feedback.
-
Thank you for providing the full code. I was able to isolate the issue. If you remove it and use Maybe it's a compatibility issue with mantine? |
Beta Was this translation helpful? Give feedback.
Thank you for providing the full code.
I was able to isolate the issue.
In the end, it comes down to the
"type": "module"
in yourpackage.json
.If you remove it and use
module.exports
innext.config.js
(instead of "export") the error will disappear.Maybe it's a compatibility issue with mantine?