79519777

Date: 2025-03-19 09:50:29
Score: 3
Natty:
Report link

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...

Reasons:
  • Blacklisted phrase (1): I have the same problem
  • Long answer (-1):
  • Has code block (-0.5):
  • Me too answer (2.5): I have the same problem
  • Low reputation (1):
Posted by: lionel-dev-fr