Update platform docs intro so following it actually works #61341
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.
Keeping this drafted at least until #60087 lands because that takes care of much of this.
What?
Updates the
intro.md
with some critical things that were missing for a workable build to be produced when following the guide. Among those:React
variant as part ofnpm create vite@latest
as without this JSX won’t work by default and react dependencies won’t be installed. The React variant also installs some other nice defaults like eslint with react related plugins.@wordpress/block-library
expectsIS_GUTENBERG_PLUGIN
and how to provide it as without this a runtime error makes for a broken app.@wordpress/block-editor/build-style/content.css
styles
prop ofBlockCanvas
as without this various things won’t be styled in the canvas.Less important changes:
?raw
param to style imports to avoid Vite ever trying to process them. This has the effect of making Vite not inject them automatically and thats why they are also rendered into astyle
tag within theEditor
component.registerCoreBlocks()
within a conditional so it won’t execute during HMR and cause errors (they are non-fatal but they sure clutter up the console). A minor downside to this is it requires an extra package@wordpress/blocks
.src/App.jsx
instead ofindex.jsx
because it’s what’ll exist when using theReact
variant and it also means thecreateRoot
/render
bits can be removed from the code sample.Along with that there were a some minor edits to either fix typos or try to make it read a little better.
Why?
To hopefully approach the expectation that following this guide will produce a working example in 10 minutes. From the docs homepage:
![image](https://cdn.statically.io/img/private-user-images.githubusercontent.com/9000376/327625856-f248367e-2bad-4d96-aec0-a90d2f0fe6b8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjI5NjUwNTksIm5iZiI6MTcyMjk2NDc1OSwicGF0aCI6Ii85MDAwMzc2LzMyNzYyNTg1Ni1mMjQ4MzY3ZS0yYmFkLTRkOTYtYWVjMC1hOTBkMmYwZmU2YjgucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDgwNiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA4MDZUMTcxOTE5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZmE3OTVkMzYzNjE2YzNjYTExYmVkMDUzMWM2ZjNkZTgxMWZjZjU0NjI0ZTJlYzNjNWFjNmJhMDMwMzk2YTM2NyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.6nCSfEBMHGngtZeIos4Wi3SD-XEkoUKpBGMv93mYxP4)
You’ll probably go well over 10 minutes if you have to discover how to fix all the gotchas you'll hit by following the guide as is.
How?
I think this is mostly covered in What. I may add some review comments.
Testing Instructions
Ensure it all looks good.