This strategy is still experimental and can only be used if the nextScriptWorkers flag is enabled in next.config.js:
next.config.js module.exports = {
  experimental: {
    nextScriptWorkers: true,
  },
}
Then, run next (normally npm run dev or yarn dev) and Next.js will guide you through the installation of the required packages to finish the setup:
Terminal npm run dev
You'll see instructions like these: Please install Partytown by running npm install @builder.io/partytown
Once setup is complete, defining strategy="worker" will automatically instantiate Partytown in your application and offload the script to a web worker.
pages/home.tsx import Script from 'next/script'
 
export default function Home() {
  return (
    <>
      <Script src="https://example.com/script.js" strategy="worker" />
    </>
  )
}