[wp-trac] [WordPress Trac] #53690: Build: Split packages and blocks to their webpack configs

WordPress Trac noreply at wordpress.org
Mon Jul 19 11:07:40 UTC 2021


#53690: Build: Split packages and blocks to their webpack configs
------------------------------+----------------------
 Reporter:  gziolo            |      Owner:  (none)
     Type:  enhancement       |     Status:  assigned
 Priority:  normal            |  Milestone:  5.9
Component:  Build/Test Tools  |    Version:  trunk
 Severity:  normal            |   Keywords:
  Focuses:                    |
------------------------------+----------------------
 It aligns with the changes proposed in Gutenberg:
 https://github.com/WordPress/gutenberg/pull/33293.

 The idea here is to split the growing webpack config into two parts:

 - blocks
 - packages

 We need to add handling for JavaScript files that are going to be used
 with blocks on the frontend. They don't work quite well with the current
 setup for entry points created for packages because of reasons like:

 - the output path is different
 - frontend scripts should not be exposed under wp globals

 In general, it looks like the split is a good strategy because it nicely
 separates two independents parts: packages and blocks. There isn't that
 much overlap between configs anyway.

 **Add View Script support for block types**

 As part of the effort, this PR adds support for `viewScript` in
 `block.json` metadata file that is later translated to `$view_script` in
 `WP_Block_Type` class and exposed as `view_script` from the REST API
 endpoint for block types.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/53690>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list