Open bobbingwide opened 1 day ago
Interestingly, since UK-tides only had one entry point, the build worked without having to create a webpack.config.js
file.
But when I moved block.json
from the plugin's root directory the build failed with the same messages I got for other plugins.
uk-tides@3.2.1 dev wp-scripts start
Skipping "./build/index.js" listed in "C:/apache/htdocs/wordpress/wp-content/plugins/uk-tides/src/oik-uk-tides/block.json". File does not exist in the "src" directory.
[webpack-cli] TypeError: Cannot convert undefined or null to object
at Function.keys (
UK-tides blocks is currently delivered with one entry point
/build/index.js
.wp-scripts
has been improved considerably. It now supports multiple blocks per plugin. UK tides doesn't need multiple blocks... but I may be moving the JavaScript source to another plugin that performs the build. So I need to build it the same way as other blocks which do have multiple entry points.Requirement
Process
npm run packages-update
webpack.config.js
to deliver the UK-tides entry point.block.json
file to refer to the appropriate entry-point and CSSsrc/index.js
as supercededwp_set_script_translations()
for the block's editor-scriptnpm run dev
npm run makepot
,npm run l10n
,npm run makejson
For plugins which have already been changed refer to the code changes in