UNPKG

1.61 kBSource Map (JSON)View Raw
1{"version":3,"file":"gatsby-browser.js","names":["onInitialClientRender","process","env","NODE_ENV","injectPartytownSnippet","collectedScriptsByPage","get","window","location","pathname","delete"],"sources":["../../../src/internal-plugins/partytown/gatsby-browser.tsx"],"sourcesContent":["import { collectedScriptsByPage } from \"gatsby-script\"\nimport { injectPartytownSnippet } from \"./utils/inject-partytown-snippet\"\nimport type { GatsbyBrowser } from \"gatsby\"\n\n// Makes sure off-main-thread scripts are loaded in `gatsby develop`\nexport const onInitialClientRender: GatsbyBrowser[`onInitialClientRender`] =\n (): void => {\n if (process.env.NODE_ENV !== `development`) {\n return\n }\n\n injectPartytownSnippet(collectedScriptsByPage.get(window.location.pathname))\n\n // Clear scripts after we've used them to avoid leaky behavior\n collectedScriptsByPage.delete(window.location.pathname)\n }\n\n// Client-side navigation (CSR, e.g. Gatsby Link navigations) are broken upstream in Partytown.\n// We need an official API from Partytown for handling re-configuration and on-demand script loading.\n// Until then, `off-main-thread` scripts load only on server-side navigation (SSR).\n// See https://github.com/BuilderIO/partytown/issues/74 for more details.\n"],"mappings":";;;;AAAA;AACA;AAGA;AACO,MAAMA,qBAA6D,GACxE,MAAY;EACV,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAM,aAAY,EAAE;IAC1C;EACF;EAEA,IAAAC,8CAAsB,EAACC,oCAAsB,CAACC,GAAG,CAACC,MAAM,CAACC,QAAQ,CAACC,QAAQ,CAAC,CAAC;;EAE5E;EACAJ,oCAAsB,CAACK,MAAM,CAACH,MAAM,CAACC,QAAQ,CAACC,QAAQ,CAAC;AACzD,CAAC;;AAEH;AACA;AACA;AACA;AAAA"}
\No newline at end of file