mirror of
https://github.com/vercel/next.js.git
synced 2026-09-20 02:25:18 +08:00
74a19b7467
## 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>
40 lines
750 B
Plaintext
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/)
|