From f8d774b72f33fa871df05dafcc6e7d4a45c9733e Mon Sep 17 00:00:00 2001 From: Thomas Kunwar <20840228+yathomasi@users.noreply.github.com> Date: Tue, 3 Sep 2024 13:00:45 +0545 Subject: [PATCH] feat: reo setup (#5305) --- gatsby-browser.js | 2 ++ gatsby-shared.tsx | 18 ++++++++++++++++++ gatsby-ssr.js | 1 + tsconfig.json | 3 ++- 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 gatsby-shared.tsx create mode 100644 gatsby-ssr.js diff --git a/gatsby-browser.js b/gatsby-browser.js index 6408214f06..7cdde155b7 100644 --- a/gatsby-browser.js +++ b/gatsby-browser.js @@ -1,2 +1,4 @@ /* eslint-env node */ require('./src/styles/global.css') + +export { wrapPageElement } from './gatsby-shared' diff --git a/gatsby-shared.tsx b/gatsby-shared.tsx new file mode 100644 index 0000000000..3558a61fd7 --- /dev/null +++ b/gatsby-shared.tsx @@ -0,0 +1,18 @@ +import { GatsbyBrowser, Script } from 'gatsby' + +const GATSBY_REO_DEV_CLIENT_ID = process.env.GATSBY_REO_DEV_CLIENT_ID + +export const wrapPageElement: GatsbyBrowser['wrapPageElement'] = ({ + element +}) => { + return ( + <> + {element} + {GATSBY_REO_DEV_CLIENT_ID && ( + + )} + + ) +} diff --git a/gatsby-ssr.js b/gatsby-ssr.js new file mode 100644 index 0000000000..0a79a1d16a --- /dev/null +++ b/gatsby-ssr.js @@ -0,0 +1 @@ +export { wrapPageElement } from './gatsby-shared' diff --git a/tsconfig.json b/tsconfig.json index da3042eecc..f413f2f38c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -24,6 +24,7 @@ "include": [ "node_modules/@dvcorg/gatsby-theme-iterative", "./src/**/*", - "./*.js" + "./*.js", + "./*.tsx" ] }