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

feat: better initial speed by preimporting entries #515

Merged
merged 4 commits into from
Feb 21, 2024

Conversation

Aslemammad
Copy link
Contributor

While trying to fix the initial load speed issue for #344 I scoped the code blocks to tsx and tried to pre-transform the mdx in codeToHtml since shiki was slowing the initial page load, but that didn't work and I found out that waku does not start importing the entries file unless we send an initial request.

This does not cause huge harm, but it's not ideal since we need to pre-import the entries the same way vite pre-transform some files, so we avoid the module imports and other side-effects (reading initial markdown files) overhead

For the initial page load issue, I could not find an easy solution for pre-transform the code blocks, but if we implement it at some point (cc @sandren), this PR is the initial step for it.

Copy link

codesandbox-ci bot commented Feb 20, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Copy link

vercel bot commented Feb 20, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
waku ✅ Ready (Inspect) Visit Preview Feb 21, 2024 2:36am

@dai-shi
Copy link
Owner

dai-shi commented Feb 21, 2024

Added a refactor commit.

tbh, this doesn't make any behavioral change for me, because the other issue make it too slow.
I'm fine to merge this as the first step because it's harmless especially in the worker.
But, my understanding was Vite prefers lazy loading and avoids eager loading when possible.

@Aslemammad
Copy link
Contributor Author

Aslemammad commented Feb 21, 2024 via email

@dai-shi dai-shi merged commit c523fcf into dai-shi:main Feb 21, 2024
28 checks passed
@Aslemammad Aslemammad deleted the feat/preimport-entries branch February 21, 2024 11:37
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.

2 participants