close
Skip to content

fix: add exports field to create-block-interactive-template#72687

Closed
harshbhonsle wants to merge 1 commit intoWordPress:trunkfrom
harshbhonsle:fix/create-block-template-exports
Closed

fix: add exports field to create-block-interactive-template#72687
harshbhonsle wants to merge 1 commit intoWordPress:trunkfrom
harshbhonsle:fix/create-block-template-exports

Conversation

@harshbhonsle
Copy link
Contributor

What?
Closes #72639

Fixes the broken @wordpress/create-block-interactive-template by adding a missing "exports" field to its package.json. This resolves the error thrown when using the template with create-block.

Why?
Currently, when using the interactive template with npx @wordpress/create-block, the CLI fails with the error:
image

Code
Invalid plugin template downloaded. Error: No "exports" main defined...
This happens because the published package lacks an "exports" field, which is required for Node.js to resolve the entry point correctly. Adding this field restores compatibility with the CLI and allows the template to be used as intended.

How?
Added the following to packages/create-block-interactive-template/package.json:

json
"exports": {
  ".": "./index.js"
}

This ensures the template can be resolved properly when downloaded and used by create-block.

Testing Instructions
Rebuild Gutenberg to apply the fix:

pnpm build

Navigate to the Gutenberg repo root:

bash
cd path/to/gutenberg

Run the create-block CLI directly using Node:

bash
node ./packages/create-block/lib/index.js my-block --template @wordpress/create-block-interactive-template

Confirm that:

  • The block scaffolds successfully
  • No error about "exports" appears
  • The plugin folder my-block is created with expected files
block

Testing Instructions for Keyboard
Not applicable — this PR does not affect UI or accessibility.

@github-actions
Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @david-j-figueroa.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Unlinked contributors: david-j-figueroa.

Co-authored-by: harshbhonsle <harshbhonsle08@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: youknowriad <youknowriad@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Oct 26, 2025
@github-actions
Copy link

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @harshbhonsle! In case you missed it, we'd love to have you join us in our Slack community.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@t-hamano t-hamano added [Type] Bug An existing feature does not function as intended [Tool] Create Block /packages/create-block labels Oct 27, 2025
@t-hamano
Copy link
Contributor

Hi @harshbhonsle, it seems we can simply remove the exports field. See #72694

I'd like to close this PR, but thank you for your efforts!

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

Labels

First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Tool] Create Block /packages/create-block [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create-block interactive template is not working anymore

2 participants