From b46e8ea1a952ad3ff3a1638591567a0bf9d7e37e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Ribeiro?= Date: Sun, 16 Jun 2024 18:14:10 -0300 Subject: [PATCH] fix: fix JoditEditor returning different types in prod and dev builds --- src/components/RichTextEditor/index.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/RichTextEditor/index.tsx b/src/components/RichTextEditor/index.tsx index b03433d..1a4708b 100644 --- a/src/components/RichTextEditor/index.tsx +++ b/src/components/RichTextEditor/index.tsx @@ -4,9 +4,11 @@ import React, { Suspense, lazy } from "react"; import { Trans, useTranslation } from "react-i18next"; import { useTheme } from "#/components/ThemeToggle/context"; -// @ts-ignore -const JoditEditor = lazy(() => import("jodit-react")); - +const JoditEditor = lazy(async () => { + // @ts-ignore + const obj = await import("jodit-react"); + return typeof obj.default === "function" ? obj : obj.default; +}); const EDITOR_BUTTONS = [ "undo", "redo",