youknowriad / blockbook

Build and Share WordPress Blocks in Isolation.
http://youknowriad.github.io/blockbook/
GNU General Public License v3.0
160 stars 17 forks source link

`Uncaught TypeError: Object(...) is not a function` when adding Core blocks #42

Open iandunn opened 3 years ago

iandunn commented 3 years ago

I'm trying to add some Core blocks, so that I can test a custom format I'm working on. I copied parts of the example, and it loads them. The Card tab has all the info, but I get an error when I click on the Example or Editor tabs.

Screen Shot 2021-02-11 at 7 49 20 AM

The only things in my .blockbook/index.js are:

import { registerBlockType } from 'blockbook-api';

// Register BlockBook blocks.
const coreBlocks = [
    'core/paragraph',
    'core/pullquote',
    'core/quote',
];
coreBlocks.forEach( ( block ) => registerBlockType( block ) );
Uncaught TypeError: Object(...) is not a function ``` ParagraphBlock webpack:///./node_modules/@wordpress/block-library/build-module/paragraph/edit.js?:103 React 11 unstable_runWithPriority webpack:///./node_modules/scheduler/cjs/scheduler.development.js?:653 React 4 unstable_runWithPriority webpack:///./node_modules/scheduler/cjs/scheduler.development.js?:653 React 3 workLoop webpack:///./node_modules/scheduler/cjs/scheduler.development.js?:597 flushWork webpack:///./node_modules/scheduler/cjs/scheduler.development.js?:552 performWorkUntilDeadline webpack:///./node_modules/scheduler/cjs/scheduler.development.js?:164 EventHandlerNonNull* webpack:///./node_modules/scheduler/cjs/scheduler.development.js?:187 webpack:///./node_modules/scheduler/cjs/scheduler.development.js?:857 js http://localhost:8081/index.f2ef4b9c7fb7d1ec5b9e.js:25837 __webpack_require__ http://localhost:8081/index.f2ef4b9c7fb7d1ec5b9e.js:20 webpack:///./node_modules/scheduler/index.js?:4 js http://localhost:8081/index.f2ef4b9c7fb7d1ec5b9e.js:25849 __webpack_require__ http://localhost:8081/index.f2ef4b9c7fb7d1ec5b9e.js:20 React 2 js http://localhost:8081/index.f2ef4b9c7fb7d1ec5b9e.js:23592 __webpack_require__ http://localhost:8081/index.f2ef4b9c7fb7d1ec5b9e.js:20 React js http://localhost:8081/index.f2ef4b9c7fb7d1ec5b9e.js:23604 __webpack_require__ http://localhost:8081/index.f2ef4b9c7fb7d1ec5b9e.js:20 webpack:///./node_modules/@wordpress/element/build-module/react-platform.js?:2 node_modules wordpress/element/build-module/react-platform.js@http://localhost:8081/index.f2ef4b9c7fb7d1ec5b9e.js:13490 __webpack_require__ http://localhost:8081/index.f2ef4b9c7fb7d1ec5b9e.js:20 webpack:///./node_modules/@wordpress/element/build-module/index.js?:56 node_modules wordpress/element/build-module/index.js@http://localhost:8081/index.f2ef4b9c7fb7d1ec5b9e.js:13454 __webpack_require__ http://localhost:8081/index.f2ef4b9c7fb7d1ec5b9e.js:20 webpack:///./node_modules/blockbook-cli/src/app/index.js?:2 js http://localhost:8081/index.f2ef4b9c7fb7d1ec5b9e.js:19066 __webpack_require__ http://localhost:8081/index.f2ef4b9c7fb7d1ec5b9e.js:20 webpack:///multi_(webpack)-dev-server/client?:2 0 http://localhost:8081/index.f2ef4b9c7fb7d1ec5b9e.js:26472 __webpack_require__ http://localhost:8081/index.f2ef4b9c7fb7d1ec5b9e.js:20 http://localhost:8081/index.f2ef4b9c7fb7d1ec5b9e.js:84 http://localhost:8081/index.f2ef4b9c7fb7d1ec5b9e.js:87 index.f2ef4b9c7fb7d1ec5b9e.js line 6558 > eval:103:97 ```

Am I doing something wrong?

youknowriad commented 3 years ago

No that looks good but I've not touched the project in a while and updated packages from Core can break it. So I'm not really sure what's happening here.

In general most of the issues comes from the fact that the tool itself uses @wordpress packages and the blocks also can use these, so resolving to the right version is often very hard.