cr0ybot / gulp-wp

A reusable, extendable, updatable Gulp workflow for WordPress themes & plugins
MIT License
26 stars 3 forks source link

Block dev & hot module reloading #36

Open cr0ybot opened 1 year ago

cr0ybot commented 1 year ago

The Human Made Webpack Helpers package includes hot module reloading for blocks. Digging into the code, it looks like this is provided by the block-editor-hmr package.

Even though we're using Gulp, Webpack is used under the hood for both the blocks and scripts tasks. It isn't immediately clear to me how the block-editor-hmr package is linked; there's a root hmr.js file that requires it, and the built-in HotModuleReplacementPlugin is added to the Webpack config. Maybe that's all that is required, but the block-editor-hmr package seems to have some unique requirements that certain things are exported from each block script, which looks like an old way of handling blocks all from one central entrypoint. It also hasn't seen an update published to npm for 3 years (though it looks like there is more recent activity in the repo), which could explain the outdated approach.