WordPress / gutenberg-examples

Examples for extending WordPress/Gutenberg with blocks.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"non-block-examples/09-code-data-basics-esnext" -> cannot run example: "Loading failed for the <script> with source “http://localhost:10033/wp-content/plugins/gtb-app/index.js?ver=2a64c5472c20f7b85e7a”."

karstengresch opened this issue · comments

Hi all,

  • System Version: macOS 13.3.1 (22E261)
  • Kernel Version: Darwin 22.4.0
  • PHP Version 8.1.9
  • WordPress 6.2
  • MySQL 8.0.16
  • Running on Local 6.7.0+6347
  • Firefox 111.0.1

I tried to follow along the example from https://developer.wordpress.org/block-editor/how-to-guides/data-basics/ using the plugin directory gtp-app. As I encountered the error described later, I replaced all files with the ones from GitHub and ran the build steps again with no success.

Used npm install npm run start and everything seems to work fine:

> 09-code-data-basics-esnext@1.1.0 start
> wp-scripts start

asset index.js 19 KiB [emitted] (name: index) 1 related asset
asset index.asset.php 174 bytes [emitted] (name: index)
Entrypoint index 19.1 KiB (19.9 KiB) = index.js 19 KiB index.asset.php 174 bytes 1 auxiliary asset
runtime modules 997 bytes 4 modules
built modules 8.45 KiB [built]
  ./src/index.js 8.2 KiB [built] [code generated]
  external ["wp","element"] 42 bytes [built] [code generated]
  external ["wp","components"] 42 bytes [built] [code generated]
  external ["wp","coreData"] 42 bytes [built] [code generated]
  external ["wp","data"] 42 bytes [built] [code generated]
  external ["wp","htmlEntities"] 42 bytes [built] [code generated]
  external ["wp","notices"] 42 bytes [built] [code generated]
webpack 5.79.0 compiled successfully in 421 ms

The problem is that basically the src/index.js isn't loading and thus the components aren't shown.

In the dev console, I get this error message:

Loading failed for the <script> with source “http://localhost:10033/wp-content/plugins/gtb-app/index.js?ver=2a64c5472c20f7b85e7a”.

The version string comes from build/index.asset.php:

<?php return array('dependencies' => array('wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-notices'), 'version' => '7de8fda5143cd9a81193');

Not sure, but maybe the doc or the example (or my setup [or I ;-| ] need to be fixed?