-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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: dynamic modulepreload #7453
Conversation
🦋 Changeset detectedLatest commit: a3fa86b The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
b4e3856
to
5c623f5
Compare
commit: |
built with Refined Cloudflare Pages Action⚡ Cloudflare Pages Deployment
|
Is it a good idea to move fetching bundle graph to the head element? |
The bundlegraph is not that important for initial interactivity, it's better that the browser spends resources on showing the page first. All the entry points get higher priority, so they will be available when you click. |
5c623f5
to
361e497
Compare
bdea31c
to
5d5c54a
Compare
ee1de36
to
23d530b
Compare
8df1c60
to
74b0661
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏👏👏@wmertens
05d51f1
to
115cee1
Compare
this applies to `pnpm serve`, because normally dev mode doesn't generate preload urls
If the dev wants to include other dynamic imports, they can just make a qrl()
separate shared chunk that does preloading and is also imported by qwik
9305441
to
da5ed64
Compare
Going off of what @GrandSchtroumpf mentioned here. If the modulepreload links are added during the critical rendering path, it is going to shave off some pagespeed points. What we've done to prevent this in our production apps at work is by adding them at the load event during the browser idle periods |
@thejackshelton looking at performance recordings, the FCP doesn't seem impacted by the modulepreloads even while the preloader is adding linkds, and in any case you can set So I think that's ok? |
@wmertens how is it going to behaves ? |
Yes correct, but it adds them as soon as the preloader loads, and we can make it happen at idle time if you see that that works better. Perhaps I should add query parameters to configure the preload for testing. In any case I don't think we should wait for the answer to this to merge, we can always refine. |
I agree, let's merge it now to start the alpha testing. Thank you very much! 🙏 |
This moves the service worker logic into the qrl handling, adding modulepreload link tags to request preloading chunks that will probably be needed soon.
This allows the browser to do its thing way better, and reduces complexity. (it would also allow some preloading in dev, but only for the SSR result, not implemented)
You can easily test the impact by going to the docs site and clicking the search button.
Features:
TODO:
qwik add service-worker
now that the starter no longer includes it