Google Lighthouse performance score

I am having bad performance scores with the Google Lighthouse score with Prismic.
Mainly the issues are “Remove unused JavaScript”, “Preconnect to required origins” and “Serve static assets with an effecient cache policy”.

We don’t even use Google Fonts and are not accessing it anywhere inside our Nuxt application. So where is this coming from?

If you use your tutorial for example, you can see that these issues are there out of the box.

All these issues seem to be on your side, so how are we supposed to reach a score of 100 using Prismic?

Hey Julian, thanks for reaching out!

One of the reasons for this is the toolbar script that exists on your page. At the moment the only solution to downsize the JS is to remove the script. You can do it if you want to reach a better score, but this is not good idea because this completely disables the Previews on your project :confused: .

We have plans on doing a feature that only injects the script when the a Preview session is
initialized. But this is only a plan and we’re not actively developing it right now. If this changes we’ll inform everyone in our blog and forum!

[UPDATE] For now one of the solutions is to still remove the toolbar, but, we're currently working on a version of the Toolbar that will greatly reduce its javascript payload (from 110kb to 10kb). But for the moment, these are some things you can do to improve performance:

  1. Again, don't load the Prismic toolbar (using the Nuxt Module it's about setting preview: false), this will help you with the performance but you'll opt-out of the preview feature.

  2. Load the toolbar script programmatically, even though is not recommended because you'll have to manually part of what the toolbar script is supposed to do (look at the preview token the writing room gives you, parse it, set the preview cookie, load the script according to that)