Partytown
Use the Partytown to run third-party scripts from a web worker
Options
- options object
Custom Partytown configuration
See https://partytown.qwik.dev/configuration/
Default:{ lib: "/~partytown/" }
Description
Partytown is a JavaScript library to run third party scripts into a web worker. The goal is dedicating the main thread to your code, and move other resource-intesive third party scripts, like analytics or tracking services to a different thread, making the website faster and more secure.
Installation
Import this plugin in your _config.ts file to use it:
import lume from "lume/mod.ts";
import partytown from "lume/plugins/partytown.ts";
const site = lume();
site.use(partytown(/* Options */));
export default site;
Add the type="text/partytown" attribute to all scripts that you want to run from the web worker:
<script type="text/partytown">...</script>