mirror of
https://github.com/withastro/astro.git
synced 2024-12-30 22:03:56 -05:00
Prevent Partytown integration from inserting a 'null' string into the body (#11829)
This commit is contained in:
parent
1ffaae04cf
commit
f1df1b3b46
2 changed files with 6 additions and 1 deletions
5
.changeset/eight-rice-tap.md
Normal file
5
.changeset/eight-rice-tap.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'@astrojs/partytown': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Prevent Partytown integration from inserting a 'null' string into the body
|
|
@ -26,7 +26,7 @@ export default function createPlugin(options?: PartytownOptions): AstroIntegrati
|
||||||
hooks: {
|
hooks: {
|
||||||
'astro:config:setup': ({ config: _config, command, injectScript }) => {
|
'astro:config:setup': ({ config: _config, command, injectScript }) => {
|
||||||
const lib = `${appendForwardSlash(_config.base)}~partytown/`;
|
const lib = `${appendForwardSlash(_config.base)}~partytown/`;
|
||||||
const recreateIFrameScript = `;(e=>{e.addEventListener("astro:before-swap",e=>{let r=document.body.querySelector("iframe[src*='${lib}']");e.newDocument.body.append(r)})})(document);`;
|
const recreateIFrameScript = `;(e=>{e.addEventListener("astro:before-swap",e=>{let r=document.body.querySelector("iframe[src*='${lib}']");if(r)e.newDocument.body.append(r)})})(document);`;
|
||||||
const partytownConfig = {
|
const partytownConfig = {
|
||||||
lib,
|
lib,
|
||||||
...options?.config,
|
...options?.config,
|
||||||
|
|
Loading…
Reference in a new issue