I have the same problem today,
it seems there is a huge update with the packages, now it exists a file called blocks-manifest.php which replicate the block.json file.
Ths file is loaded in the plugin's main file like this
function create_block_toto_block_init() {
if ( function_exists( 'wp_register_block_types_from_metadata_collection' ) ) { // Function introduced in WordPress 6.8.
wp_register_block_types_from_metadata_collection( __DIR__ . '/build', __DIR__ . '/build/blocks-manifest.php' );
} else {
if ( function_exists( 'wp_register_block_metadata_collection' ) ) { // Function introduced in WordPress 6.7.
wp_register_block_metadata_collection( __DIR__ . '/build', __DIR__ . '/build/blocks-manifest.php' );
}
$manifest_data = require __DIR__ . '/build/blocks-manifest.php';
foreach ( array_keys( $manifest_data ) as $block_type ) {
register_block_type( __DIR__ . "/build/{$block_type}" );
}
}
} add_action( 'init', 'create_block_toto_block_init' );
with two new php functions introduced to fill automatically the register_block_type function:
wp_register_block_types_from_metadata_collection is scheduled for Wordpress 6.8...
npm run build create the blocks-manifest.php into the build folder but npm start doesn't
I think it's a bug...