no-sync-scripts.mdx


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

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

<script src="https://third-party-script.js" async />
<script src="https://third-party-script.js" defer />

Rendered from the public repository vercel/next.js on GitHub; content belongs to its authors. Cached for up to an hour.

errors/no-sync-scripts.mdx · vercel/next.js | Docs MD