Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Doesn't work with Yarn PNP #128

Open
xanderim opened this issue Dec 25, 2024 · 3 comments
Open

[Bug] Doesn't work with Yarn PNP #128

xanderim opened this issue Dec 25, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@xanderim
Copy link

Hi, thank you for the package!

  • After installing and importing the package in monorepo project with Yarn PNP enabled
image - After adding the missing dependency manually image

the code:

import { useState } from 'react';
import RichTextEditor, { BaseKit } from 'reactjs-tiptap-editor';

// Import CSS
import 'reactjs-tiptap-editor/style.css';

const extensions = [
  BaseKit.configure({
    // Show placeholder
    placeholder: {
      showOnlyCurrent: true,
    },

    // Character count
    characterCount: {
      limit: 50_000,
    },
  }),
];

const DEFAULT = '';

const Editor = () => {
  const [content, setContent] = useState(DEFAULT);

  const onChangeContent = (value: any) => {
    setContent(value);
  };

  return (
    <RichTextEditor
      output='html'
      content={content}
      onChangeContent={onChangeContent}
      extensions={extensions}
    />
  );
};

export default Editor;

I understand that it's not related to reactjs-tiptap-editor directly, but I don't use the mermaid extension and don't plan to. Is it possible to excluded extensions that I don't use from the build? Thanks.

similar issue facebook/docusaurus#10645

@hunghg255
Copy link
Owner

Hi, thank you for the package!

  • After installing and importing the package in monorepo project with Yarn PNP enabled

image - After adding the missing dependency manually image
the code:

import { useState } from 'react';
import RichTextEditor, { BaseKit } from 'reactjs-tiptap-editor';

// Import CSS
import 'reactjs-tiptap-editor/style.css';

const extensions = [
  BaseKit.configure({
    // Show placeholder
    placeholder: {
      showOnlyCurrent: true,
    },

    // Character count
    characterCount: {
      limit: 50_000,
    },
  }),
];

const DEFAULT = '';

const Editor = () => {
  const [content, setContent] = useState(DEFAULT);

  const onChangeContent = (value: any) => {
    setContent(value);
  };

  return (
    <RichTextEditor
      output='html'
      content={content}
      onChangeContent={onChangeContent}
      extensions={extensions}
    />
  );
};

export default Editor;

I understand that it's not related to reactjs-tiptap-editor directly, but I don't use the mermaid extension and don't plan to. Is it possible to excluded extensions that I don't use from the build? Thanks.

similar issue facebook/docusaurus#10645

this lib has some problem with yarn install, I am not sure. can you try use npm or pnpm

@hunghg255 hunghg255 added the bug Something isn't working label Dec 26, 2024
@xanderim
Copy link
Author

@hunghg255 thank you for the quick reply. I think the main issue here is that unused extensions should not be bundled into the main package. It would make the package size smaller and avoid issues with external dependencies. I am not an expert on tree-shaking but I assume all extensions should be tree-shakeable.

@condorheroblog
Copy link
Contributor

Yes, I think so too. Some dependencies should be marked as external dependencies and let users install them themselves, such as docx, mermaid, etc. These dependencies are large and heavy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants