NUXT -- Delayed prismic library load in nuxt app

I'm looking to stagger the load of my prismic blog library so that it doesn't bog down the pageload speed of our landing page. currently loading in prismic universally via the nuxt.config.js file, with html-serializer.js and link-resolver.js files in the /plugins directory.

I'm only utilizing the blog on the specific /blog url, so would like to only load it on that page if possible.

Any help would be greatly appreciated. Thanks

Hey Team,

Welcome to the community!

Can you tell me a little more about the issue you’re seeing? Is it the load time of the @prismic/nuxt library? How are you deploying your site, if you are statically deploying your project then I’m not sure this would be a big issue.

Thanks.

Hi Phil, thanks for getting back to me. This project is a PWA built with nuxt being deployed via Netlify. Loving Prismic, as it’s been a great blog solution for our clients, but this is the last piece that I can’t figure out.

removing the @prismic/nuxt library raises the score by over 10 points.

our main focus is on load time for our landing/home page, which does not utilize prismic in any way. wanting to know if there’s a strategy to limit the loading of prismic to a single component in nuxt, if it exists.

So this is not the library itself, this is the Preview script that is loaded as part of the library. You can disable this script but obviously this means you’ll lose Preview functionality.

If you wish to do so, then in in your nuxt.config.js file under the prismic module option declare preview as false like so:

prismic: {
  endpoint: 'https://your-repo-name.cdn.prismic.io/api/v2',
  preview: false
},

Once done you can no longer preview draft content in your blog pages.

that did it. thanks so much, phil. we now know what to do if the clients need this feature enabled in the future, but for now this addresses the issue. thank you.

1 Like