Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify in docs that next/script must not be in next/head #27534

Merged
merged 6 commits into from
Aug 1, 2021
Merged
6 changes: 5 additions & 1 deletion docs/basic-features/script.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ export default function Home() {
}
```

With `next/script`, you no longer need to wrap scripts in `next/head`. Further, `next/script` should **not** be used in `pages/_document.js` as `next/script` has client-side functionality to ensure loading order. For example:
Now, you use `next/script` in the body of your Next.js page. It has client-side functionality that decides when and how to load the remote script based on the `strategy`.

> **Note:**
>
> - `next/script` **must not** be placed in either a `next/head` component or in `pages/_document.js`.

```js
// After
Expand Down