From dee2253fe825b6c890c011dfdf44188d1e3d31ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ra=C4=8D=C3=A1k?= Date: Wed, 15 May 2024 13:56:20 +0200 Subject: [PATCH] Fix missing __dirname in the browser --- gitCms/GitCmsConstants.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gitCms/GitCmsConstants.ts b/gitCms/GitCmsConstants.ts index 276a9c3ef71..85e3e9b4961 100644 --- a/gitCms/GitCmsConstants.ts +++ b/gitCms/GitCmsConstants.ts @@ -20,7 +20,8 @@ function findNearestGitRepo(startPath: string): string | null { return null } -const repoPath = findNearestGitRepo(__dirname) +const repoPath = + typeof __dirname !== "undefined" ? findNearestGitRepo(__dirname) : null // todo: refactor GitCmsServer to be a class, and pass this in as a top level param export const GIT_CMS_DIR = repoPath ? repoPath + "/../owid-content" : ""