Partytown does not require a config for it to work, however a config can be set to change the defaults. At the lowest level, it’s configured by setting the window.partytown = {...} object before the Partytown snippet script. However, higher-level integrations, such as the <Partytown/> component found in, should provide utilities to make setting the config easier

debugWhen true, Partytown scripts are not inlined and not minified. See the Debugging docs on how to enable more logging.
forwardAn array of strings representing function calls on the main thread to forward to the web worker. See Forwarding Events and Triggers for more info.
libPath where the Partytown library can be found your server. Note that the path must both start and end with a / character, and the files must be hosted from the same origin as the webpage. Default is /~partytown/
loadScriptsOnMainThreadAn array of strings or regular expressions (RegExp) used to filter out which script are executed via Partytown and the main thread. An example is as follows: loadScriptsOnMainThread: ["", "inline-script-id", /regex-matched-script\.js/].
resolveUrlHook that is called to resolve URLs which can be used to modify URLs. The hook uses the API: resolveUrl(url: URL, location: URL, method: string). See the Proxying Requests for more information.
nonceThe nonce property may be set on script elements created by Partytown. This should be set only when dealing with content security policies and when the use of unsafe-inline is disabled (using nonce-* instead).

Vanilla Config

What we mean by “vanilla config”, is that the Partytown config can be set without any higher-level integration. Below is an example of setting the debug config. Notice that the config script tag is before the Partytown snippet script. Additionally, the config or snippet scripts should NOT contain the type="text/partytown" attribute (this small amount of JavaScript we need to run on the main thread to initialize everything).

    <title>Vanilla Config Example</title>
      partytown = {
        debug: true,
      /* Inlined Partytown Snippet */

Please see the integration guides for more information.

Made with ❤️ by

© 2024, Inc.

Introducing Visual Copilot.

100% free. Supports all popular frameworks.

Try Visual Copilot