6

I built a plugin that adds a few custom blocks to guenberg and built a website using gutenberg. Today I wanted to test it with page speed insights and found out that my website has now a lot of render-blocking JS files... All these js files seems to be from gutenberg. My score is 40... What did I do wrong and how can I fix it? I have other websites with my custom blocks and these have 90+ score. Here is the list of render blocking JS files:

  • /wp-includes/js/dist/vendor/lodash.min.js
  • /wp-includes/js/dist/vendor/regenerator-runtime.min.js
  • /wp-includes/js/dist/vendor/wp-polyfill.min.js
  • /wp-includes/js/dist/vendor/react.min.js
  • /wp-includes/js/dist/vendor/react-dom.min.js
  • /wp-includes/js/dist/dom-ready.min.js
  • /wp-includes/js/dist/hooks.min.js
  • /wp-includes/js/dist/i18n.min.js
  • /wp-includes/js/dist/a11y.min.js
  • /wp-includes/js/dist/url.min.js
  • /wp-includes/js/dist/api-fetch.min.js
  • /wp-includes/js/dist/blob.min.js
  • /wp-includes/js/dist/autop.min.js
  • /wp-includes/js/dist/block-serialization-default-parser.min.js
  • /wp-includes/js/dist/deprecated.min.js
  • /wp-includes/js/dist/dom.min.js
  • /wp-includes/js/dist/escape-html.min.js
  • /wp-includes/js/dist/element.min.js
  • /wp-includes/js/dist/is-shallow-equal.min.js
  • /wp-includes/js/dist/keycodes.min.js
  • /wp-includes/js/dist/priority-queue.min.js
  • /wp-includes/js/dist/compose.min.js
  • /wp-includes/js/dist/redux-routine.min.js
  • /wp-includes/js/dist/data.min.js
  • /wp-includes/js/dist/html-entities.min.js
  • /wp-includes/js/dist/shortcode.min.js
  • /wp-includes/js/dist/blocks.min.js
  • /wp-includes/js/dist/vendor/moment.min.js
  • /wp-includes/js/dist/date.min.js
  • /wp-includes/js/dist/primitives.min.js
  • /wp-includes/js/dist/rich-text.min.js
  • /wp-includes/js/dist/warning.min.js
  • /wp-includes/js/dist/components.min.js
  • /wp-includes/js/dist/keyboard-shortcuts.min.js
  • /wp-includes/js/dist/notices.min.js
  • /wp-includes/js/dist/token-list.min.js
  • /wp-includes/js/dist/wordcount.min.js
  • /wp-includes/js/dist/block-editor.min.js
  • /wp-content/plugins/my_plugin/build/blocks/card-block.js
  • /wp-content/plugins/my_plugin/build/blocks/card-row-block.js
  • /wp-content/plugins/my_plugin/build/blocks/special-header-row-block.js
2
  • Did you do the test logged in? If so, repeat it from a browser where you're just a guest.
    – kero
    Oct 6, 2022 at 12:18
  • @kero google BOT that does the test is not logged as admin on my website.
    – Mateusz
    Oct 6, 2022 at 12:22

1 Answer 1

9

Ok so...
The problem was caused because I loaded these scripts on the front end in my plugin but these are needed only by editor. To solve this all I had to do was change the content of my block.json files - replace the "script" with "editorScript" so these js files are loaded only for editor :-)

3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.