-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scripts: Convert file extension to js in block.json
during build
#41068
Conversation
Size Change: -1.76 kB (0%) Total Size: 1.24 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea to make it less error-prone. It's probably confusing whether to provide the path from the src
folder or from the build folder when using non-standard extension 😅
At the moment, you could provide the path ending with .js
and webpack would check also for other extensions, but I agree that having both cases covered will improve the experience.
There is one issue to resolve and we will be good to go. We also keep the history of changes in the CHANGEOG file:
block.json
during build
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great!
We also keep the history of changes in the CHANGELOG file:
Do you need help with this part?
@gziolo I wrote a changelog. Is it OK like this? |
It's perfect! Thank you so much for handling this enhancement. What has been the experience with TypeScript and blocks so far? Do we need to add anything to the default configuration to make it simple to work with? |
…p-tests-config * 'trunk' of github.com:WordPress/gutenberg: (88 commits) Components: refactor `AlignmentMatrixControl` to pass `exhaustive-deps` (#41167) [RNMobile] Add 'Insert from URL' option to Image block (#40334) [RNMobile] Improvements to Getting Started Guides (#40964) Post Author Name: Add to and from Post Author transformations (#41151) CheckboxControl: Add unit tests (#41165) Improve inline documentation (#41209) Mobile Release v1.76.1 (#41196) Use explicit type definitions for entity configuration (#40995) Scripts: Convert file extension to js in `block.json` during build (#41068) Reflects revert in 6446878 (#41221) get_style_nodes should be compatible with parent method. (#41217) Gallery: Opt-in to axial (column/row) block spacing controls (#41175) Table of Contents block: convert line breaks to spaces in headings. (#41206) Add support for button elements to theme.json (#40260) Global Styles: Load block CSS conditionally (#41160) Update URL (#41188) Improve autocompleter performance (#41197) Site Editor: Set min-width for styles preview (#41198) Remove Navigation Editor screen from experiments page (#40878) Fix broken Page title for pages created inline within in Nav block (#41063) ...
What?
Convert the file extensions of viewScript, script, and editScript in block.json to js.
Why?
If use
editorScript:index.tsx
in block.json, it will build correctly, but register_block_type will not load the script. we will need to convert the value of theeditorScript
to the built file.How?
o convert block.json.
Convert block.json using transform in CopyWebpackPlugin