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

There's a problem with the MDC component that makes it too heavy and ruins your website's performance (blocking resource) #101

Open
imlautaro opened this issue Nov 28, 2023 · 5 comments

Comments

@imlautaro
Copy link

I don't know what is the exact problem but there's something wrong for sure because it doesn't happens with the nuxt/content module.

 WARN                                                                                                                                                                    20:26:55  
(!) Some chunks are larger than 500 kBs after minification. Consider:
- Using dynamic import() to code-split the application
- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks
- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.
@nobkd
Copy link
Contributor

nobkd commented Nov 29, 2023

Not sure, what exactly causes this, but #93 (with nuxt/content#2422) might be related?

@imlautaro
Copy link
Author

Not sure, what exactly causes this, but #93 (with nuxt/content#2422) might be related?

Actually it's weird because if I use the utility "parseMarkdown" from "@nuxtjs/MDC/runtime" but rendering it with the ContentRenderer from "nuxt/content", it's still heavy but not that much, it doesn't affect that much to the performance and it's "acceptable"

@Sfolkerts89
Copy link

I have found the same issue. The MDC script is over 60% in size of the client bundle and seems to render client side. Which makes little to no sense to me.

@stefanobartoletti
Copy link
Contributor

stefanobartoletti commented Apr 24, 2024

I'm not sure if this is related, but I just opened an issue concerning the remark-emoji dependency, which is quite heavy #187

And I agree that is a bit weird that this is client-side script.

@Sfolkerts89
Copy link

Sfolkerts89 commented Apr 27, 2024

I have managed to write a composable that uses MDC to render an HTML object and then returns this as a string. This renders server side and in my test repo, i have seen a block time decrease from 1270ms to just 420ms on mobile (Lighthouse).

Im pretty sure it can be written more effeciently, but it does the job!

EDIT:
It still seems to still bundle the MDC script to the client, but the performance is already major (1270 to 420 ms as mentioned)

EDIT nr. 2:

Using the experimental feature: 'componentIslands' and adding the 'server' suffix to my component, the mobile performance index in Lighthouse went from 90 to 100.
Using this feature before my composable didnt yield any difference.

Here's the composable:
https://github.com/Sfolkerts89/Nuxt3-starter__Decap-cms/blob/main/composables/mdToHtml.js

And here is the component i use to mount/ render:
https://github.com/Sfolkerts89/Nuxt3-starter__Decap-cms/blob/main/components/misc/ParseMarkdown.vue

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

No branches or pull requests

4 participants