-
Notifications
You must be signed in to change notification settings - Fork 22
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
Is there a way to minimize usage or properly tree-shake emojilib
dependency?
#187
Comments
Any updates @farnabaz ? |
Thanks for the issue and pinging export default defineNuxtConfig({
mdc: {
remarkPlugins: {
'remark-emoji': false
}
}
}) |
@adamdehaven There will be a breaking change in the next version for using the module outside of Nuxt.
|
As long as it’s documented 👍 Could the |
I'm in the process of optimizing a Nuxt website, and I noticed that there is a quite large part of the bundle that is made up of the
emojilib
package.A quick analysis of my
pnpm-lock.yaml
is telling me that this dependency is loaded from@nuxtjs/mdc
>remark-emoji
>node-emoji
>emojilib
As you can see from the breakdown (this is the output of
nuxi analyze
), theemojis.json
chunk is quite large, ~205/35gzip kb.Is there a way to minimize its usage? I would say that not every project that needs Markdown also needs emojis, especially not the full library, especially since it has such relevant import cost.
Is there a way to properly tree-shake it, whitelist it, or any other way to reduce its size and avoid such heavy and mostly unused bundle? I also find it puzzling to see this running client-side.
Another possible solution would be to make
remark-emoji
an optional dependency, since, from what I see by reading its docs https://github.com/rhysd/remark-emoji, this package is used to transform emojis from this notation:rocket:
to the proper emoji 🚀 (which is not handled by this library, but by an emoji font).So in cases where the content editor directly uses emojis and not the
::
notation, the whole package is basically not even used.Thanks for this great module anyway, this is just a minor but useful optimization 💚
The text was updated successfully, but these errors were encountered: