-
Notifications
You must be signed in to change notification settings - Fork 69
Open
Description
Our project moved to vite 8 and now we're getting react error 130:
Element type is invalid: expected a string (for built-in components) or a class/function
(for composite components) but got: object.
This is with v1.31.12 and this import:
import ReactJson from '@microlink/react-json-view';There seems to be an interop/export-shape problem with @microlink/react-json-view (UMD/CJS wrapping can make a “default import” resolve to a module object, and React then throws: “got: object”).
We worked around the issue by importing the module namespace and normalizing to the actual component (default or reactJsonView) before rendering:
import * as ReactJsonViewModule from '@microlink/react-json-view';
const ReactJson =
((ReactJsonViewModule as any).default ??
(ReactJsonViewModule as any).reactJsonView ??
ReactJsonViewModule) as React.ComponentType<any>;After this, <ReactJson ... /> is always a real component at runtime.
Can this change be avoided? Is there something missing in this package?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels