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)

Hi @juliandreas,

Just a quick update. The team worked hard to split the code for the toolbar so that it only loads the full preview script for logged in Prismic users. This should greatly help your lighthouse score :slight_smile:

Old: 120kB for everyone
New: 14kB for everyone + additional 130kB if detected as a logged in member of the Prismic repo / in a preview session.

We have more detailed information about this on our progress page.
https://portal.productboard.com/dy3xgwivwydsw7gltxfso9gs/c/85-prismic-toolbar-4-0-0-10x-smaller-fix-close-preview-issue-and-of-ie11-support

The Google Font has been removed in version 4.0.9:

Thanks.

4 Likes