Prevents [theme app extensions](/docs/apps/build/online-store/theme-app-extensions) from using JavaScript files and external scripts with a compressed size greater than the configured [`threshold_in_bytes`](#threshold_in_bytes). Limiting the size of JavaScript files helps to improve the [performance](/docs/storefronts/themes/best-practices/performance) of your theme app extension. You occasionally might need to load large JavaScript bundles. In these cases, you can use an [import on interaction pattern](https://addyosmani.com/blog/import-on-interaction/) to avoid having users who don't interact with a component execute the bundle. ## Example In the following example, the size of `assets/chat-widget.js` is checked to make sure that it doesn't exceed the specified `threshold_in_bytes`: ```liquid {% schema %} { ... "javascript": "chat-widget.js" } {% endschema %} ``` ## Options The following example contains the default configuration for this check: ```yaml AssetSizeAppBlockJavaScript: enabled: false severity: suggestion threshold_in_bytes: 10_000 ``` | Parameter | Description | | --- | --- | | `enabled` | Whether the check is enabled. | | `severity` | The [severity](/docs/storefronts/themes/tools/theme-check/configuration#check-severity) of the check. | | `threshold_in_bytes` | The maximum allowed compressed size, in bytes, for a single JavaScript file. Reflects the [suggested limit](/docs/apps/build/online-store/theme-app-extensions/configuration#file-and-content-size-limits) for theme app extension JavaScript, and includes the app and remote scripts. | ## Disabling this check This check is enabled by default when you run the Shopify CLI 3.x [`build`](/docs/api/shopify-cli/app/app-build) command on an app that contains a theme app extension. This limit is not yet enforced, but disabling this check isn't recommended for theme app extensions. This check is disabled by default when you run the Shopify CLI 2.x [`shopify theme check`](/docs/storefronts/themes/tools/theme-check/commands) command.