how-to-gutenberg-plugin icon indicating copy to clipboard operation
how-to-gutenberg-plugin copied to clipboard

Several build errors

Open Elschnuppero opened this issue 6 years ago • 1 comments

In a fresh installation of the plugin i get several build errors:

[email protected] dev C:\xxx\wp-content\plugins\how-to-gutenberg-plugin-master
cross-env BABEL_ENV=default webpack --watch
Webpack is watching the files…
Hash: 92ab71e04b3c917dae58
Version: webpack 3.11.0
Time: 463ms
                       Asset     Size  Chunks             Chunk Names
./assets/js/editor.blocks.js  7.73 kB       0  [emitted]  ./assets/js/editor.blocks
   [0] ./blocks/index.js 153 bytes {0} [built]
   [1] ./blocks/i18n.js 50 bytes {0} [built]
   [2] ./blocks/register-block-type/index.js 960 bytes {0} [built] [failed] [1 error]
   [3] ./blocks/demo/index.js 1.24 kB {0} [built] [failed] [1 error]

ERROR in ./blocks/demo/index.js
Module build failed: SyntaxError: C:/xxx/wp-content/plugins/how-to-gutenberg-plugin-master/blocks/demo/index.js: Unexpected token (46:16)

  44 |             const onChangeMessage = message => { setAttributes( { message } ) };
  45 |             return (
> 46 |                 <div className={ className }>
     |                 ^
  47 |                     <h2>{ __( 'Call to Action', 'jsforwphowto' ) }</h2>
  48 |                     <RichText
  49 |                         tagName="div"

 @ ./blocks/index.js 10:0-17

ERROR in ./blocks/register-block-type/index.js
Module build failed: SyntaxError: C:/xxx/wp-content/plugins/how-to-gutenberg-plugin-master/blocks/register-block-type/index.js: Unexpected token (34:20)

  32 |
  33 | // Create variable for block header since using it twice
> 34 | const blockHeader = <h2>{ __( 'registerBlockType Explained', 'jsforwphowto' ) }</h2>;
     |                      ^
  35 |
  36 |
  37 | /**

 @ ./blocks/index.js 9:0-32

NPM runs on 5.6.0 and Node on 8.11.3. Any idea?

Edit: Sorry for the terrible code display.

Elschnuppero avatar Jun 23 '18 12:06 Elschnuppero

the .babelrc file is not available in the root directory, that's why there are built issues, create a .babelrc file inside your plugin root with this code

{
	"presets": [ "@wordpress/default"]
}

dazunE avatar Jul 11 '18 15:07 dazunE