Skip to content

React 16 is not supported even though peer deps say it is #1127

@jeffsee55

Description

@jeffsee55

Description

Built files make use of the react/jsx-runtime module, but list "react" >= "16.8.0" in their peerDependencies. The result is an error when consuming this package with an app using anything < 17.0.0.

Steps

When you build the packages, look at the dist/index.es.js and you'll see the use of react/jsx-runtime, which isn't present before React 17, here's the alignment-ui package contents:

import 'react';
import { KEYS_ALIGN, upsertAlign } from '@udecode/plate-alignment';
import { someNode, getPreventDefaultHandler } from '@udecode/plate-common';
import { useStoreEditorState, useEventEditorId } from '@udecode/plate-core';
import { ToolbarButton } from '@udecode/plate-toolbar';
import { jsx } from 'react/jsx-runtime';

const ToolbarAlign = ({
  type,
  unwrapTypes = KEYS_ALIGN,
  ...props
}) => {
  const editor = useStoreEditorState(useEventEditorId('focus'));
  return /*#__PURE__*/jsx(ToolbarButton, {
    active: !!(editor !== null && editor !== void 0 && editor.selection) && !!type && someNode(editor, {
      match: {
        type
      }
    }),
    onMouseDown: editor ? getPreventDefaultHandler(upsertAlign, editor, {
      type,
      unwrapTypes
    }) : undefined,
    ...props
  });
};

export { ToolbarAlign };
//# sourceMappingURL=index.es.js.map

Expectation

Be able to run this on an app using React < 17

Environment

  • slate: 0.66.0
  • slate-react: 0.66.0
  • browser: chrome

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingvendor

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions