From cc8ad312e63132925366f28555eeabcd96e9e9b5 Mon Sep 17 00:00:00 2001 From: Jon Surrell Date: Wed, 24 Jan 2024 16:23:47 +0100 Subject: [PATCH] Add viewScriptModule support --- packages/scripts/README.md | 8 ++++---- packages/scripts/utils/block-json.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/scripts/README.md b/packages/scripts/README.md index e4a2be8d9a3fa..4a3c037ce78f9 100644 --- a/packages/scripts/README.md +++ b/packages/scripts/README.md @@ -108,9 +108,9 @@ This script automatically use the optimized config but sometimes you may want to - `--webpack-src-dir` – Allows customization of the source code directory. Default is `src`. - `--output-path` – Allows customization of the output directory. Default is `build`. -Experimental support for the block.json `viewModule` field is available via the +Experimental support for the block.json `viewScriptModule` field is available via the `--experimental-modules` option. With this option enabled, script and module fields will all be -compiled. The `viewModule` field is analogous to the `viewScript` field, but will compile a module +compiled. The `viewScriptModule` field is analogous to the `viewScript` field, but will compile a module and should be registered in WordPress using the Modules API. #### Advanced information @@ -396,9 +396,9 @@ This script automatically use the optimized config but sometimes you may want to - `--webpack-src-dir` – Allows customization of the source code directory. Default is `src`. - `--output-path` – Allows customization of the output directory. Default is `build`. -Experimental support for the block.json `viewModule` field is available via the +Experimental support for the block.json `viewScriptModule` field is available via the `--experimental-modules` option. With this option enabled, script and module fields will all be -compiled. The `viewModule` field is analogous to the `viewScript` field, but will compile a module +compiled. The `viewScriptModule` field is analogous to the `viewScript` field, but will compile a module and should be registered in WordPress using the Modules API. #### Advanced information diff --git a/packages/scripts/utils/block-json.js b/packages/scripts/utils/block-json.js index 892cc63c889e5..e086405dd7455 100644 --- a/packages/scripts/utils/block-json.js +++ b/packages/scripts/utils/block-json.js @@ -1,4 +1,4 @@ -const moduleFields = new Set( [ 'viewModule' ] ); +const moduleFields = new Set( [ 'viewScriptModule', 'viewModule' ] ); const scriptFields = new Set( [ 'viewScript', 'script', 'editorScript' ] ); /**