Skip to main content

Offload 3rd party scripts to Web Workers

Third Party Scripts are at times the biggest performance drains of our projects. In most cases the degradation in performance is due to these external JavaScript files blocking the main thread.

Party town is a simple library that offloads the execution of these third party JavaScript libraries

Link to repo https://github.com/BuilderIO/partytown Warning : Alpha

React

import Head from 'next/head';
import { Partytown } from '@builder.io/partytown/react';

const Home = () => {
return (
<>
<Head>
<title>My App</title>
<Partytown />
<script src="https://example.com/analytics.js" type="text/partytown"></script>
</Head>
<main>...</main>
</>
);
};

export default Home;