-
Notifications
You must be signed in to change notification settings - Fork 431
Distribution
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/
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.
The lib/debug
directory has the same purpose as the lib
, but instead will console log more information, 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