index.asset.php tells WordPress what scripts to load before index.js. WordPress reads this file during block registration and builds the correct <script> dependency chain. A missing or incorrect dependency causes index.js to silently fail — the block appears in the inserter but the editor UI is blank.
Minimum index.asset.php
<?php
return array(
'dependencies' => array(
'wp-blocks',
'wp-element',
'wp-block-editor',
'wp-components',
'wp-i18n',
),
'version' => '1.0.0',
);
With Element Registry Dependencies
If the block calls window.wptElements.buildElementClasses(), declare wpt-element-registry and every individual element handle the block uses:
<?php
return array(
'dependencies' => array(
'wp-blocks',
'wp-element',
'wp-block-editor',
'wp-components',
'wp-i18n',
'wpt-element-registry', // always required when using any element
'wpt-element-heading', // declare every element the block uses
'wpt-element-description',
'wpt-element-button',
'wpt-element-badge',
),
'version' => '1.0.0',
);
Available wpt-element Handles
| Handle | Element |
|---|---|
wpt-element-registry |
Base registry — required alongside every element handle |
wpt-element-heading |
Heading element |
wpt-element-description |
Description / body text element |
wpt-element-button |
Button element |
wpt-element-badge |
Badge / label element |
wpt-element-image |
Image element |
wpt-element-eyebrow |
Eyebrow text element |
wpt-element-icon |
Icon element |
Only declare handles for elements the block actually uses.
Never include wp-primitives in the dependencies array. It is not a registered script handle in this context and causes the entire block to silently fail to load. The block validator warns on this specific pattern.