[ad_1]
I am trying to create a block with the help of @wordpress/scripts package. I tried this example but with HMR ( Hot Module Replacement ). Everything works fine except, my changes is not reflecting to the browser. It reloads the page but when i added the module.hot.accept() code, its through error – Block is already registered.
import { registerBlockType } from '@wordpress/blocks';
import json from './block.json';
const { name } = json;
// Register the block
registerBlockType( name, {
edit: () => {
return (
<p style={{fontWeight: 'normal'}}>New Holla 2!</p>
)
},
save: () => {
return (
<p>Holla Save!</p>
)
},
} );
if (module.hot) {
module.hot.accept();
}Can someone point the right direction, why i am getting this error or going to wrong way?
