-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Description
It is very convenient and tidy to keep inner blocks source code inside parent blocks. It keeps track of parent-child relationship and the whole structure when having many blocks in single plugin is better, since it is organized in a tree instead of being flat and has less entries in top level structure. I had so far positive experience developing with such organization and wordpress-scripts compilation works fine.
Example of folder structure (each folder contains single block):
slider
|__ slide
event-manager
|__ event
tabs-block
|__ tabs-header
|__ tabs-card
However, with new introduced wp_register_block_types_from_metadata_collection which speeds up block registration and therefore editor initialization, I see this warning: PHP Deprecated: dirname(): Passing null to parameter #1 ($path) of type string is deprecated .... When I flatten the block structure, meaning that all nested block folders are moved to same level as parent blocks, error disappears.
Proposed solution is to rewrite @wordpress/scripts code for --blocks-manifest switch to enable nested structure (if needed) and rewrite wp_register_block_types_from_metadata_collection to load blocks from nested folders without errors.