Files
vercel__next.js/errors/no-sync-scripts.mdx
Jam Balaya 74a19b7467 docs: unify the header deps by removing # (#72391)
## Summary
Remove redundant `#` from [error
pages](https://github.com/vercel/next.js/tree/canary/errors).

## Description
Follow up #52038 and #72263.
Updated
[template.txt](https://github.com/vercel/next.js/blob/canary/errors/template.txt)
and clarified the header deps.
Then rewrite as per the template.

### Improving Documentation

- [x] Run `pnpm prettier-fix` to fix formatting issues before opening
the PR.
- [x] Read the Docs Contribution Guide to ensure your contribution
follows the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2024-11-07 08:58:43 +00:00

40 lines
750 B
Plaintext

---
title: No Sync Scripts
---
> Prevent synchronous scripts.
## Why This Error Occurred
A synchronous script was used which can impact your webpage performance.
## Possible Ways to Fix It
### Script component (recommended)
```jsx filename="pages/index.js"
import Script from 'next/script'
function Home() {
return (
<div class="container">
<Script src="https://third-party-script.js"></Script>
<div>Home Page</div>
</div>
)
}
export default Home
```
### Use `async` or `defer`
```html
<script src="https://third-party-script.js" async />
<script src="https://third-party-script.js" defer />
```
## Useful Links
- [Efficiently load third-party JavaScript](https://web.dev/efficiently-load-third-party-javascript/)