Lazy Load Provider #32
Replies: 8 comments 4 replies
-
Can think of some approaches that might work, but need to know more. Why do you want to lazy load |
Beta Was this translation helpful? Give feedback.
-
To keep the first load JS size lower! It's a web optimization thing, but if we could combine #28 and have some |
Beta Was this translation helpful? Give feedback.
-
@tmm unfortunately the |
Beta Was this translation helpful? Give feedback.
-
after some tests, the first-load js penalty for including |
Beta Was this translation helpful? Give feedback.
-
+1 on this discussion. wagmi is increasing the first-load JS of my pages pretty significantly (even on pages where there's no need to run any child hooks). A bunch of my pages are statically rendered in NextJS, and this first-load js increase is bringing down the lighthouse scores a bit.
|
Beta Was this translation helpful? Give feedback.
-
Hey @shunkakinoki, I've used I'd also love to get @shrugs's thoughts on this since your comment here suggests that this is not possible. I might be missing something huge here. 🙏 cc @tmm |
Beta Was this translation helpful? Give feedback.
-
This is really huge cc @tmm |
Beta Was this translation helpful? Give feedback.
-
@albertputrapurnama ah, I've tested this out and figured out what's happening. by making the provider itself dynamic, none of the app can load until that dynamic component is loaded, so that first run js is being executed anyway it's just hidden behind one more server request, which is almost certainly less efficient than including it in the initial bundle and running it anyway. the nextjs firstload just doesn't measure that correctly, since that js is technically code-split out. |
Beta Was this translation helpful? Give feedback.
-
Thank you for an amazing repo!
Just wanted to ask you, is there any way to lazy load the provider?
If so, is there any recommended way to do this?
Would love to learn.
(It would be nice to not having to put the provider in
_app.js
in next.js, and rather lazy loading it for example)Beta Was this translation helpful? Give feedback.
All reactions