Answer the question
In order to leave comments, you need to log in
How in Nuxt to reduce the size of the window.__NUXT__ object with SSR?
Good afternoon!
When creating a page on the server (SSR), Nuxt, in addition to the template, generates a js object with window.__NUXT__ data .
If the object turns out to be large, it affects PageSpead + the search robot will download and parse unnecessary data.
Is it possible to somehow reduce this object? For example, for static components, it is better not to add data that cannot change at all.
Answer the question
In order to leave comments, you need to log in
PageSpeed, like Lighthouse, in any case, will swear at either a bunch of JS code or polyfills, which are sometimes loaded for some reason even in modern mode. The __NUXT__ object is needed to reproduce the state of Vue so that it then works and does not do extra rendering. And so completely static components do not give data to it, since they have neither state nor props. In my experience, data values and i18n translations take up most of __NUXT__ , the less you use them, the less __NUXT__ will be. There are no other ways to reduce its size.
Add the no-prefetch attribute to nuxt-link and then you will not have all the data pulled
https://nuxtjs.org/docs/2.x/features/nuxt-componen...
It stores dynamic data received from the outside for the correct operation of SSR. For example, what came from the back.
The easiest way to reduce this block is to get only the necessary data. Check if all of them are actually used on the page.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question