You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When importing this project to use in a custom block in the WordPress block editor, the component does not work and instead shows a bunch of errors:
Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: object.
Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
Describe the bug
When importing this project to use in a custom block in the WordPress block editor, the component does not work and instead shows a bunch of errors:
I have a workaround for this (see below).
Image Gallery Version
1.3.0
To Reproduce
@wordpress/create-block
package to scaffold a custom block.react-image-gallery
component as a dependency.import ImageGallery from 'react-image-gallery';
Expected behavior
The
react-image-gallery
component should import and render without error.Client info (please complete the following information):
Additional context
I am running Node v20 and NPM v10, and set
"type": "module"
inpackage.json
so the project is fully ESM.By searching around, I found a workaround that works in #727. I changed my code:
I don't understand why this workaround works, and it seems like it shouldn't be necessary.
The text was updated successfully, but these errors were encountered: