Gatsby Prismic remove unused JavaScript

I’m looking to optimise the performance of my Gatsby Prismic projects and the remaining issue I have from a JavaScript perspective appears to be a bunch of scripts that are loaded by gatsby-source-prismic (as far as I can tell).

These are the files that are being loaded:

|…/node_modules/prismic-javascript/dist/prismic-javascript.min.js | 6.2 KiB | 4.5 KiB
|…/node_modules/prismic-dom/dist/prismic-dom.min.js | 4.1 KiB | 2.9 KiB
|…/node_modules/fp-ts/lib/ReadonlyArray.js | 3.8 KiB | 2.6 KiB
|…/node_modules/superstruct/lib/ | 2.2 KiB | 1.7 KiB
|…/node_modules/prismic-javascript/node_modules/cross-fetch/dist/browser-polyfill.js | 1.6 KiB | 1.4 KiB

I was wondering if there is anything I can do on my end to optimise this?

Hi Rob,

Some of that libraries are necessary when using Prismic such as /prismic-javascript.min.js and prismic-dom.min.js and the browser-polyfill.js that is used by prismic-javascript.

For the others I don't know from where they come, it would be great if you can share with us the Prismic project the uses them.

Please let us know if you need any further help.