mantine
mantine copied to clipboard
@mantine/code-highlight huge bundle size
What package has an issue
@mantine/code-highlight
Describe the bug
As @mantine/code-highlight includes all files of higlight.js it increases the bundle size by about 300kb (gzip).
What version of @mantine/* packages do you have in package.json? (Note that all @mantine/* packages must have the same version in order to work correctly)
7.0.1
If possible, please include a link to a codesandbox with the reproduced problem
No response
Do you know how to fix the issue
None
Are you willing to participate in fixing this issue and create a pull request with the fix
None
Possible fix
May introduce some kind of lazy-loading or config which languages should be included.
Hi! I proposed a package that might address this issue. Ended up with smaller bundle size. In the given example, I use typescript and javascript. The gzipped size for highlight.js in the bundle is around 12.23 KB.
Could you please give feedback? I would love to hear your suggestions! Thanks! @rtivital @wuifdesign 😁
it think this will work, but would be a breaking change if added to the main package. 2 same packages is somewhat strange.
i also tried to implement some lazy loading, but haven't found a way that works nice with all bundlers.
This is not planned to be changed/fixed.