This commit is contained in:
MuslemRahimi 2025-03-05 14:35:32 +01:00
parent 6b5dddf4d5
commit 3ce5292aab
4 changed files with 42 additions and 1 deletions

14
package-lock.json generated
View File

@ -19,6 +19,7 @@
},
"devDependencies": {
"@bprogress/core": "^1.2.3",
"@builder.io/partytown": "^0.10.3",
"@internationalized/date": "^3.5.5",
"@playwright/test": "^1.43.1",
"@rollup/plugin-dynamic-import-vars": "^2.1.2",
@ -457,6 +458,19 @@
"dev": true,
"license": "MIT"
},
"node_modules/@builder.io/partytown": {
"version": "0.10.3",
"resolved": "https://registry.npmjs.org/@builder.io/partytown/-/partytown-0.10.3.tgz",
"integrity": "sha512-N2SWA3c5vEad3rgdAFM3zMb6uc7aXqibkgAz4ijvYzycgQXJ4dE5oH6fGFMXSQWj6ayVlLT1/CmpflYUJHfmQg==",
"dev": true,
"license": "MIT",
"bin": {
"partytown": "bin/partytown.cjs"
},
"engines": {
"node": ">=18.0.0"
}
},
"node_modules/@choojs/findup": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/@choojs/findup/-/findup-0.2.1.tgz",

View File

@ -19,6 +19,7 @@
},
"devDependencies": {
"@bprogress/core": "^1.2.3",
"@builder.io/partytown": "^0.10.3",
"@internationalized/date": "^3.5.5",
"@playwright/test": "^1.43.1",
"@rollup/plugin-dynamic-import-vars": "^2.1.2",

View File

@ -1,7 +1,7 @@
<script lang="ts">
import "../app.css";
import "../app.pcss";
import { partytownSnippet } from "@builder.io/partytown/integration";
//import { Toaster } from "svelte-french-toast";
import { Toaster } from "svelte-sonner";
import "@bprogress/core/css";
@ -242,6 +242,30 @@
<svelte:window bind:innerWidth={$screenWidth} />
<svelte:head>
<script>
// Forward the necessary functions to the web worker layer
partytown = {
forward: ["dataLayer.push", "gtag"],
};
</script>
{@html "<script>" + partytownSnippet() + "</script>"}
<script
type="text/partytown"
src="https://www.googletagmanager.com/gtag/js?id=G-CLFNW10SND"
></script>
<script type="text/partytown">
window.dataLayer = window.dataLayer || [];
window.gtag = function () {
dataLayer.push(arguments);
};
gtag("js", new Date());
gtag("config", "G-CLFNW10SND");
</script>
</svelte:head>
<div class="app {$page?.url?.pathname === '/' ? 'bg-[#000]' : ''}">
<div class="flex min-h-screen w-full flex-col bg-default">
<div class="w-full">

View File

@ -1,4 +1,5 @@
import { sveltekit } from "@sveltejs/kit/vite";
import { partytownVite } from '@builder.io/partytown/utils';
//import { visualizer } from "rollup-plugin-visualizer";
/** @type {import('vite').UserConfig} */
@ -6,6 +7,7 @@ const config = {
plugins: [
//visualizer({ open: true }) // Plugin to visualize the bundle
sveltekit(),
partytownVite(),
],
server: {