Developing a dynamic block scaffolded with @wordpress/createblock. #69246
hollands-spoor
started this conversation in
Developer Experience
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm developing a block using @wordpress/create-block with the --variant parameter set to dynamic. During debugging, the render.php file used by the block (and thus the debugger) is located in the build directory. I use the Xdebug extension in VSCode, which means that when I step through render.php in the build directory and want to make changes, I need to remember to open the render.php file from the src directory and make the corresponding changes there. Ofcourse, I often forget this because my mind is in debug mode. As a result, I mistakenly make changes to the render.php in the build directory, only to find later that it gets overwritten.
Therefore, I find it more convenient during development to let the block in the build directory use the render.php file from the src directory. To achieve this, the block.json in the build directory should have the entry 'render': '../src/render.php' when I run 'wp-scripts start' and should contain the regular './render.php' when building for production. I have added an additional webpack.config.js with a homemade plugin that makes this change in build/block.json during development. However, it would be a nice feature if I could simply provide a parameter for this in the scripts available in package.json.
Beta Was this translation helpful? Give feedback.
All reactions