sjdemartini / mui-tiptap

A Material UI (MUI) styled WYSIWYG rich text editor, using Tiptap
MIT License
320 stars 44 forks source link

Reduce amount of peer dependencies #51

Closed bryanjtc closed 1 year ago

bryanjtc commented 1 year ago

I just found this package. It's amazing and it's the alternative I was looking to replace react-mui-draft-wysiwyg.

Is your feature request related to a problem? Please describe.

Right now, I know this package depends on a lot of @tip/tap packages. It creates a clutter in the package.json

    "@tiptap/core": "2.0.3",
    "@tiptap/extension-blockquote": "2.0.3",
    "@tiptap/extension-bold": "2.0.3",
    "@tiptap/extension-bubble-menu": "2.0.3",
    "@tiptap/extension-bullet-list": "2.0.3",
    "@tiptap/extension-code": "2.0.3",
    "@tiptap/extension-code-block": "2.0.3",
    "@tiptap/extension-document": "2.0.3",
    "@tiptap/extension-dropcursor": "2.0.3",
    "@tiptap/extension-floating-menu": "2.0.3",
    "@tiptap/extension-gapcursor": "2.0.3",
    "@tiptap/extension-hard-break": "2.0.3",
    "@tiptap/extension-heading": "2.0.3",
    "@tiptap/extension-history": "2.0.3",
    "@tiptap/extension-image": "2.0.3",
    "@tiptap/extension-italic": "2.0.3",
    "@tiptap/extension-link": "2.0.3",
    "@tiptap/extension-list-item": "2.0.3",
    "@tiptap/extension-ordered-list": "2.0.3",
    "@tiptap/extension-paragraph": "2.0.3",
    "@tiptap/extension-placeholder": "2.0.3",
    "@tiptap/extension-strike": "2.0.3",
    "@tiptap/extension-subscript": "2.0.3",
    "@tiptap/extension-superscript": "2.0.3",
    "@tiptap/extension-table": "2.0.3",
    "@tiptap/extension-table-cell": "2.0.3",
    "@tiptap/extension-table-header": "2.0.3",
    "@tiptap/extension-table-row": "2.0.3",
    "@tiptap/extension-task-item": "2.0.3",
    "@tiptap/extension-task-list": "2.0.3",
    "@tiptap/extension-text": "2.0.3",
    "@tiptap/pm": "^2.0.3",
    "@tiptap/react": "2.0.3",

Side note: Why do you need react-icons when you have @mui/icons-material that already works with tree-shaking? https://mui.com/material-ui/guides/minimizing-bundle-size/

Describe the solution you'd like

Remove react-icons and just use @mui/icons-material. Include @tip-tap peer depenencies as dependences in this package.

sjdemartini commented 1 year ago

Hi @bryanjtc, thanks so much for checking out the package and for filing these detailed issues! You're the first person to come across it 😄 as I haven't posted it anywhere yet. The package is new and I'm still working on some touch-ups (including some documentation), and literally the next thing on my list is cutting down the peer dependencies. I will follow up soon.

As for why react-icons, it's primarily for the TableBubbleMenu, which has several icons for very table-specific actions:

image

I agree that it'd be nice to rely exclusively on @mui/icons-material but unfortunately it does not have the equivalent icons in its set. In my experience using react-icons, tree-shaking works fine. And I've tested https://github.com/btd/rollup-plugin-visualizer / https://www.npmjs.com/package/vite-bundle-visualizer against mui-tiptap now and do see that react-icons is being tree-shaken:

image
sjdemartini commented 1 year ago

The peer dependency list has been cut down significantly as of v1.0.0-beta.2, which I published a couple hours ago.

sjdemartini commented 1 year ago

@bryanjtc I'm curious to get your thoughts on this discussion https://github.com/sjdemartini/mui-tiptap/issues/119#issuecomment-1668061213, specifically around changing react-icons to a direct dependency of mui-tiptap (instead of a peer dep) so that it need not be added to a consuming project's package.json. (Someone else brought up the same concern as you regarding the extra icon package dep.) Thanks!