[wp-trac] [WordPress Trac] #60233: Support module metadata in block.json
WordPress Trac
noreply at wordpress.org
Thu Jan 11 14:51:21 UTC 2024
#60233: Support module metadata in block.json
-------------------------+-----------------------------
Reporter: jonsurrell | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: normal | Keywords:
Focuses: |
-------------------------+-----------------------------
Problem:
Scripts and styles can be registered for blocks via block.json metadata.
There is now a Modules API, but no way to register or associate module
assets with blocks via block.json metadata or the
`register_block_type_from_metadata` function.
Proposed solution:
Introduce module fields analogous to the script fields currently supported
in block.json.
The end goal would be to support `editorModule`, `module`, and
`viewModule`. An initial version could support only `viewModule` given
that most functionality provided by WordPress for working with the editor
is only available as scripts and not accessible to modules at this time.
Background:
See https://github.com/WordPress/gutenberg/issues/57492 for prior
discussion in Gutenberg.
- Add support for viewModule in block.json when registering a block from
metadata. https://github.com/WordPress/gutenberg/pull/57437
- Add experimental support to @wordpress/scripts for module compilation
and support `viewModule`:
https://github.com/WordPress/gutenberg/pull/57461
- Add support to @wordpress/dependency-extraction-webpack-plugin for
module compilation and extraction of assets files.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/60233>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list