Skip to content

Add support for block metadata viewScriptModule field #685

Description

@kaitlinbolling

Description

We should add support for the viewScriptModule metadata field so that we can make use of the Interactivity API. This will require supporting the wp-scripts --experimental-modules flag, which changes the default Webpack configuration. See https://make.wordpress.org/core/2024/03/04/block-metadata-viewscriptmodule-field-in-6-5/

Use Case

When a developer defines the viewScriptModule field in a block's metadata registration, it should compile appropriately so that the script runs correctly on the front end.

Activity

  1. self-assigned this
    on Jan 24, 2025
  2. kaitlinbolling commented on Jan 24, 2025

    @kaitlinbolling
    ContributorAuthor

    It looks like the --experimental-modules might change the Webpack config from an object to an array of two configs. See comment and the Webpack config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementNew feature or requestgutenbergRequires understanding GutenbergtypescriptRequires understanding TypeScript

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions