vue-lazy-hydration icon indicating copy to clipboard operation
vue-lazy-hydration copied to clipboard

Question: exclude async components from init load

Open Kolobok12309 opened this issue 4 years ago • 2 comments
trafficstars

I use this package and it worked well with hydration and async componnets. But can i exclude some async components, from initial html scripts? I have NavBar with some only mobile and only desktop elements, but nuxt load all of them(hydration work as expected)

Kolobok12309 avatar Aug 05 '21 12:08 Kolobok12309

Reproduce Code Page

If you go to page link, you can see script /_nuxt/tutorial-lazy.js in ssr html, but component async I know that vue-lazy-hydration not call it, check it in console. For some components it work as expected(load only when trigger hydration)

Kolobok12309 avatar Aug 19 '21 11:08 Kolobok12309

This issue is more related to vue-server-renderer which Nuxt.js depends on. If an async script is used on the server when rendering the page, vue-server-renderer will automatically inject it into the HTML.

So you are looking for a way to tell vue-server-renderer to not automatically render some async scripts. This is being disscussed (since a long time 😄 ) in this issue and this PR

paulnta avatar Sep 09 '21 18:09 paulnta