diff --git a/packages/integrations/partytown/src/index.ts b/packages/integrations/partytown/src/index.ts index 93cf4a61a722..77dcfd76c13c 100644 --- a/packages/integrations/partytown/src/index.ts +++ b/packages/integrations/partytown/src/index.ts @@ -21,7 +21,7 @@ export default function createPlugin(options?: PartytownOptions): AstroIntegrati let partytownSnippetHtml: string; const partytownEntrypoint = resolve('@builder.io/partytown/package.json'); const partytownLibDirectory = path.resolve(partytownEntrypoint, '../lib'); - const SELF_DESTRUCT_ON_VIEW_TRANSITION = `;((d,s)=>(s=d.currentScript,d.addEventListener('astro:before-swap',()=>s?.remove(),{once:true})))(document);` + const SELF_DESTRUCT_ON_VIEW_TRANSITION = `;((d,s)=>(s=d.currentScript,d.addEventListener('astro:before-swap',()=>s.remove(),{once:true})))(document);` return { name: '@astrojs/partytown', hooks: {