Skip to content

Support wp-scripts --experimental-modules without block.json #68908

Open
@nextgenthemes

Description

It is my understanding that --experimental-modules is only to read the viewScriptModule from a block.json and compile that as a module. Is this correct? WHY?

When the PHP API for script modules got introduced, the make core post about said devs are encouraged to switch to modules. So why does wp-scripts not let us compile them from normal entry scripts? How are we supposed to compile things that just plain plugin/theme JS that is not related to blocks. I can create a dummy fake block.json to trick it into compiling a generic script, but that seems annoying.

And what does wp-script/webpack actually does differently when using this flag. I found no information about it and why it seems it restricted to a block.json only.

I would also be interested in more information what wp-scripts actually does besides like not compiling certain imports that come with WordPress into the files.

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions