From fd0b5fd6e4f3959d279c6871231e04adb800299d Mon Sep 17 00:00:00 2001 From: Thomas Heartman Date: Wed, 2 Mar 2022 13:56:54 +0100 Subject: [PATCH] Revert "fix: remove node-fetch and SSR to fix the build" This reverts commit e106943e4b29a307cd590f01de00f21ba2ba9183. --- website/src/theme/Root.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/website/src/theme/Root.tsx b/website/src/theme/Root.tsx index a8b597b62a..d89436590a 100644 --- a/website/src/theme/Root.tsx +++ b/website/src/theme/Root.tsx @@ -2,6 +2,7 @@ import React from 'react'; import UserFeedback from '@site/src/components/UserFeedback'; import { UnleashClient } from 'unleash-proxy-client'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; +import nodeFetch from 'node-fetch' // Default implementation, that you can customize function Root({ children }) { @@ -10,11 +11,17 @@ function Root({ children }) { } = useDocusaurusContext(); + const unleashSsrOptions = { + disableMetrics: true, + fetch: nodeFetch + } + const unleashConfig = { clientKey: customFields.unleashProxyClientKey as string, url: customFields.unleashProxyUrl as string, disableRefresh: true, appName: `docs.getunleash.io-${customFields.environment}`, + ...(typeof fetch === "undefined" ? unleashSsrOptions : {}) }; const [showFeedback, setShowFeedback] = React.useState(false);