diff --git a/gatsby-node.js b/gatsby-node.js index 2fc6371fc6a..2a22e22c3db 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -2,8 +2,13 @@ const language_config = require(`./i18n-config.js`) const language_config_en = require(`./i18n-config-en.js`) const path = require('path') +const { copyLibFiles } = require('@builder.io/partytown/utils') const translations_cache = {} + +exports.onPreBuild = async () => { + await copyLibFiles(path.join(__dirname, 'static', '~partytown')) +} // Based upon https://github.com/gatsbyjs/gatsby/tree/master/examples/using-i18n exports.onCreatePage = ({ page, actions }) => { const { createRedirect, createPage, deletePage } = actions diff --git a/gatsby-ssr.js b/gatsby-ssr.js index 90207542394..4a68d992d1d 100644 --- a/gatsby-ssr.js +++ b/gatsby-ssr.js @@ -1,42 +1,55 @@ import React from 'react' +import { Partytown } from '@builder.io/partytown/react' import { WrapPagesWithLocaleContext } from './src/components/localization' import './src/components/localization/config' import GlobalProvider from './src/store/global-provider' export const wrapRootElement = ({ element }) => { - return {element} + return {element} } export const wrapPageElement = WrapPagesWithLocaleContext export const onRenderBody = ({ setHeadComponents }) => { - const gtmTrackingId = process.env.GATSBY_GOOGLE_TAG_MANAGER_TRACKING_ID || '' + const gtmTrackingId = process.env.GATSBY_GOOGLE_TAG_MANAGER_TRACKING_ID || '' - setHeadComponents([ - + ), + gtmTrackingId && ( +