Version 0.5.0+

Prevents using theme JavaScript files and external scripts with a compressed size greater than the configured threshold_in_bytes. Limiting the size of JavaScript files helps to improve the performance of your theme.

You occasionally might need to load large JavaScript bundles. In these cases, you can use an import on interaction pattern to avoid having users who don't interact with a component execute the bundle.


Below are examples of code that fails and passes this check.

✗ Fail

In this example, assets/chat-widget.js is greater than 10 KB gzipped.

✓ Pass


The following example contains the default configuration for this check.

Parameter Description
enabled Whether this check is enabled.
threshold_in_bytes Determines the maximum allowed compressed size, in bytes, for a single JavaScript file. This includes the theme and remote scripts.

Disabling this check

If you can't avoid violating the rule, you should disable the check using the comment syntax. This ensures that you intentionally disable the check for each instance.