Having run npm run update-scripts I then tried to build sb-children-block but it failed with
> sb-children-block@1.0.1 dev C:\apache\htdocs\wordpress\wp-content\plugins\sb-children-block
> wp-scripts start
[webpack-cli] Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration.output has an unknown property 'jsonpFunction'. These properties are valid:
object { assetModuleFilename?, asyncChunks?, auxiliaryComment?, charset?, chunkFilename?, chunkFormat?, chunkLoadTimeout?, chunkLoading?, chunkLoadingGlobal?, clean?, compareBeforeEmit?, crossOriginLoading?, cssChunkFilename?, cssFilename?, devtoolFallbackModuleFilenameTemplate?, devtoolModuleFilenameTemplate?, devtoolNamespace?, enabledChunkLoadingTypes?, enabledLibraryTypes?, enabledWasmLoadingTypes?, environment?, filename?, globalObject?, hashDigest?, hashDigestLength?, hashFunction?, hashSalt?, hotUpdateChunkFilename?, hotUpdateGlobal?, hotUpdateMainFilename?, iife?, importFunctionName?, importMetaName?, library?, libraryExport?, libraryTarget?, module?, path?, pathinfo?, publicPath?, scriptType?, sourceMapFilename?, sourcePrefix?, strictModuleErrorHandling?, strictModuleExceptionHandling?, trustedTypes?, umdNamedDefine?, uniqueName?, wasmLoading?, webassemblyModuleFilename?, workerChunkLoading?, workerWasmLoading? }
-> Options affecting the output of the compilation. `output` options tell webpack how to write the compiled files to disk.
Did you mean output.chunkLoadingGlobal (BREAKING CHANGE since webpack 5)?
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! sb-children-block@1.0.1 dev: `wp-scripts start`
npm ERR! Exit status 2
Looks like I need to follow a similar process to update this plugin as used for oik and other block plugins.
The block is currently delivered with one entry point /build/index.js.
wp-scripts has been improved considerably. It now supports multiple blocks per plugin.
Requirement
Update to benefit from improvements to wp-scripts from the @wordpress/scripts package
Simplify / reduce the code needed to support internationalization
Register each block so that only the required code is loaded for the blocks that are used.
Understand what's needed to enqueue the required CSS in the block editor and on the front end.
Process
Update wp-scripts using npm run packages-update
Remove webpack.config.js
Change each block's block.json file to refer to the appropriate entry-points and CSS
Mark src/index.js as superceded
Update server logic
Call wp_set_script_translations() for each block's editor-script
Having run
npm run update-scripts
I then tried to build sb-children-block but it failed withLooks like I need to follow a similar process to update this plugin as used for oik and other block plugins.
The block is currently delivered with one entry point
/build/index.js
.wp-scripts
has been improved considerably. It now supports multiple blocks per plugin.Requirement
Process
Update wp-scripts using
npm run packages-update
Remove
webpack.config.js
Change each block's
block.json
file to refer to the appropriate entry-points and CSSMark
src/index.js
as supercededUpdate server logic
Call
wp_set_script_translations()
for each block's editor-scriptBuild using
npm run dev
Test
For plugins which have already been changed refer to the code changes in https://github.com/bobbingwide/sb-starting-block/issues/3 and https://github.com/bobbingwide/oik-bob-bing-wide/issues/42