Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/components/VideoPlayer/VideoPlayer.tsx
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
10 changes: 9 additions & 1 deletion src/plugins/Emojis/EmojiPicker.tsx
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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 = {
Expand Down