Skip to content
Adam Bradley edited this page Dec 15, 2021 · 4 revisions

Partytown is distributed from @builder.io/partytown using NPM. Within the distribution there are a few directories, each with their own purpose.

@builder.io/partytown/
β”œβ”€β”€ integration/
β”œβ”€β”€ lib/
β”œβ”€β”€ react/
└── utils/

lib/

The lib directory contains the static files that should be hosted from the same origin as the website. Hosting from the same origin is a requirement of the service worker scope. The lib static files are minified and meant for production use.

@builder.io/partytown/lib/
β”œβ”€β”€ partytown-sandbox-atomics.html
β”œβ”€β”€ partytown-sw.js
└── partytown.js

The partyown.js file must be in the <head> before all other third-party scripts, and should not have the async or defer attributes. Because the script must be executed immediately, and since it's such a small file, it's always preferred to inline the partytown.js script content, rather than it being an additional http request.

lib/debug/

The lib/debug directory has the same purpose as the lib, but instead will console log more information and files themselves are not minified. Additionally, you'll notice there are more debug files than the production lib files, and that's because the lib files inline many scripts. For example, the web worker script is inlined, rather than being a separate request.

The lib/debug files are not meant to be used in production. See the Partytown Configuration docs on how to enable debug mode.

@builder.io/partytown/lib/debug/
β”œβ”€β”€ partytown-sandbox-atomics.html
β”œβ”€β”€ partytown-sandbox-atomics.js
β”œβ”€β”€ partytown-sandbox-sw.js
β”œβ”€β”€ partytown-sw.js
β”œβ”€β”€ partytown-ww-atomics.js
β”œβ”€β”€ partytown-ww-sw.js
└── partytown.js
Clone this wiki locally