Start using modules in the interactive create-block template #56694
Merged
DAreRodz merged 2 commits intoDec 5, 2023
Conversation
|
Size Change: 0 B Total Size: 1.72 MB ℹ️ View Unchanged
|
2 tasks
SantosGuillamot
approved these changes
Dec 5, 2023
Contributor
SantosGuillamot
left a comment
There was a problem hiding this comment.
I've tested it, and everything seems to be working fine 🙂
Before this PR
It throws some errors in the console, the interactive block created doesn't work, an the script doesn't have any type.
After this PR
The block created works as expected and the script contains `type="module"' .
Contributor
|
@vcanales can we include this PR into 17.2? Thank you! 🙏 |
vcanales
pushed a commit
that referenced
this pull request
Dec 5, 2023
* Start using modules * Update changelog
Member
|
Backported to 17.2 RC |
cbravobernal
pushed a commit
that referenced
this pull request
Dec 7, 2023
* Start using modules * Update changelog
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Update the interactive create-block template (
create-block-interactive-template) to start using modules instead of scripts.Why?
Because, starting from Gutenberg 17.2, the Interactivity API will only be available using modules:
How?
For now, I've just removed the
viewScriptand registered/enqueued theview.jsfile directly to make it work. I think that should be enough until we changewp-scriptsto support modules.Testing Instructions
create-blockfoldernode index.js --template ../create-block-interactive-template interactive-block.wp-env.override.jsonfile"plugins": [ ".", "./packages/create-block/interactive-block" ],wp-envview.jsfile was loaded using modules (<script type="module" src="...src/view.js">)