ahmadawais / create-guten-block

📦 A zero-configuration #0CJS developer toolkit for building WordPress Gutenberg block plugins.
https://Awais.dev/cgb-post
MIT License
3.16k stars 329 forks source link

You may need an appropriate loader to handle this file type. #85

Open strarsis opened 6 years ago

strarsis commented 6 years ago

A react component (KenburnsEditor) causes a build error when imported in the gutenblock:

import { KenburnsEditor } from 'kenburns-editor';

A fork (forked off from gre) has to be used currently:

yarn add github:strarsis/kenburns-editor
yarn build
./node_modules/kenburns-editor/src/KenburnsEditor.js
Module parse failed: Unexpected token (310:13)
You may need an appropriate loader to handle this file type.
|     if (!innerRect) {
|       return <div style={styles} />;
|     }
brianjohnhanna commented 6 years ago

I believe the issue may be related to the presets being used for babel loader - we are including the env preset but not the react one as far as I can see.

Have you tried ejecting in a separate branch (npm run eject) and adjusting any of the config?

You would probably need to run npm install @babel/preset-react and then add "react" to the babel.presets array in your package.json. Then try to build.