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

Declare lowlight as a peerDependency in @tiptap/extension-code-block-lowlight #2625

Merged

Conversation

enriquecastl
Copy link
Contributor

This PR declares the lowlight package as a peerDependency and removes the direct import statement in the @tiptap/extension-code-block-lowlight package.

Why is this change necessary?

The client application can’t control which version of lowlight is bundled into the final product even when the client application provides its own lowlight instance. A consequence of this situation is that using a newer major version of lowlight ends up forcing the client application to bundle two versions of lowlight/highlight.js/fault in the final distribution build. That‘s a lot of dead JavaScript code.

The main purpose of this change is reducing the bundle size of this extension by removing the duplication of lowlight versions in the codebase.

@netlify
Copy link

netlify bot commented Mar 15, 2022

Deploy Preview for tiptap-embed failed.

Name Link
🔨 Latest commit f0c85b9
🔍 Latest deploy log https://app.netlify.com/sites/tiptap-embed/deploys/629d6a394bf92c00080c9cd6

@enriquecastl enriquecastl force-pushed the declare-lowlight-as-a-peer-dependency branch 2 times, most recently from 50beee6 to fe83b6b Compare March 15, 2022 14:29
@bdbch
Copy link
Contributor

bdbch commented May 17, 2022

Thanks @enriquecastl! Do you think we should include this change in some kind of documentation for the extension or should we just keep it with the console.warning you implemented?

@enriquecastl enriquecastl force-pushed the declare-lowlight-as-a-peer-dependency branch 2 times, most recently from e0904cd to f59bfb6 Compare June 6, 2022 02:40
Declare lowlight as a peerDependency to delegate
the control of which version of lowlight is used
to the client application
@enriquecastl enriquecastl force-pushed the declare-lowlight-as-a-peer-dependency branch from f59bfb6 to f0c85b9 Compare June 6, 2022 02:45
@enriquecastl
Copy link
Contributor Author

Thanks @enriquecastl! Do you think we should include this change in some kind of documentation for the extension or should we just keep it with the console.warning you implemented?

Hi @bdbch! Thanks for the great suggestion. There’s value in documenting how this dependency depends and interact with lowlight. I’ve pushed a documentation update. What do you think?

@bdbch
Copy link
Contributor

bdbch commented Jun 6, 2022

Great @enriquecastl thanks a lot! 👍

@bdbch bdbch merged commit 39f5e4c into ueberdosis:main Jun 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants