/
githubmirror
/
next.js
Обзор
Документация
Войти
/
githubmirror
/
next.js
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
canary
errors/no-script-component-in-head.mdx
52 строки
942 B
Delba de Oliveira
docs: Move optimizing pages to guides (#78500)
24 апр 2025, 21:40
Не верифицирован
24 апр 2025, 21:40
76ade73
Код
Авторство
О чём код?
--- title: No Script Component in Head --- > Prevent usage of `next/script` in `next/head` component. ## Why This Error Occurred The `next/script` component should not be used in a `next/head` component. ## Possible Ways to Fix It Move the `<Script />` component outside of `<Head>` instead. **Before** ```jsx filename="pages/index.js" import Script from 'next/script' import Head from 'next/head' export default function Index() { return ( <Head> <title>Next.js</title> <Script src="/my-script.js" /> </Head> ) } ``` **After** ```jsx filename="pages/index.js" import Script from 'next/script' import Head from 'next/head' export default function Index() { return ( <> <Head> <title>Next.js</title> </Head> <Script src="/my-script.js" /> </> ) } ``` ## Useful Links - [next/head](/docs/pages/api-reference/components/head) - [next/script](/docs/pages/guides/scripts)