diff --git a/src/components/VideoPlayer/VideoPlayer.tsx b/src/components/VideoPlayer/VideoPlayer.tsx index 53fdc9779..47d70799b 100644 --- a/src/components/VideoPlayer/VideoPlayer.tsx +++ b/src/components/VideoPlayer/VideoPlayer.tsx @@ -1,7 +1,16 @@ import { useComponentContext } from '../../context'; -import ReactPlayer from 'react-player'; +import ReactPlayerImport from 'react-player'; import React from 'react'; +// react-player ships as CJS with the component on `exports.default`. Some +// bundler/interop setups (e.g. Vite serving our built ESM as a linked workspace +// dependency) hand back the module namespace `{ default }` instead of the +// component itself, which makes React throw "Element type is invalid ... got: +// object". Unwrap the default defensively so it works regardless of interop. +const ReactPlayer = + (ReactPlayerImport as unknown as { default?: typeof ReactPlayerImport }).default ?? + ReactPlayerImport; + export type VideoPlayerProps = { isPlaying?: boolean; videoUrl?: string; diff --git a/src/plugins/Emojis/EmojiPicker.tsx b/src/plugins/Emojis/EmojiPicker.tsx index cfc398c66..4972da647 100644 --- a/src/plugins/Emojis/EmojiPicker.tsx +++ b/src/plugins/Emojis/EmojiPicker.tsx @@ -1,5 +1,5 @@ import React, { useEffect, useState } from 'react'; -import Picker from '@emoji-mart/react'; +import PickerImport from '@emoji-mart/react'; import { useMessageComposerContext, useTranslationContext } from '../../context'; import { @@ -11,6 +11,14 @@ import { import { usePopoverPosition } from '../../components/Dialog/hooks/usePopoverPosition'; import { useIsCooldownActive } from '../../components/MessageComposer/hooks/useIsCooldownActive'; +// @emoji-mart/react ships as CJS with the component on `exports.default`. Under +// spec-strict ESM interop (e.g. Vite 8 / Rolldown, native Node ESM) a default +// import yields the module namespace `{ default }` instead of the component, +// which makes React throw "Element type is invalid ... got: object". Unwrap the +// default defensively so it works regardless of interop. +const Picker = + (PickerImport as unknown as { default?: typeof PickerImport }).default ?? PickerImport; + const isShadowRoot = (node: Node): node is ShadowRoot => !!(node as ShadowRoot).host; export type EmojiPickerProps = {