Closed npmDude closed 4 years ago
How did you register your blocks? Maybe they are using the same name as our blocks? And does your plugin have any relations to this plugin (like depending on it or something similar)?
I just did what was stated on the documentation on wordpress. I am using block name 'button' but my plugin name is different from yours. No relation at all.
Here is a sample `$asset_file = include(plugin_dir_path(FILE) . 'build/index.asset.php');
wp_register_script(
'trt-blocks',
plugins_url('build/index.js', __FILE__),
$asset_file['dependencies'],
$asset_file['version']
);
wp_register_style(
'trt-blocks-editor',
plugins_url('build/index.css', __FILE__),
array('wp-edit-blocks', 'trt-blocks'),
$asset_file['version']
);
wp_register_style(
'trt-blocks',
plugins_url('build/style-index.css', __FILE__),
array(),
$asset_file['version']
);
register_block_type('trt-blocks/button', array(
'editor_style' => 'trt-blocks-editor',
'editor_script' => 'trt-blocks',
));
register_block_type('trt-blocks/location', array(
'style' => 'trt-blocks',
'editor_style' => 'trt-blocks-editor',
'editor_script' => 'trt-blocks',
));`
And does it also happen when you do not register your trt-blocks/button
block? Could you maybe also show me the code where you register this block in JavaScript?
It is not the trt-blocks/button
that is making the error. After a few more testing it seems that if two plugins that uses the latest version of wp-scripts both used the css import feature provided particularly the style.scss file. Then the error will occur,
Ah now I get it. You're totally right, I could reproduce the described issue with another plugin which bases on @wordpress/scripts
. This seems to be an issue of the @wordpress/scripts
package itself. I've seen that you already created an issue in the Gutenberg repository (https://github.com/WordPress/gutenberg/issues/23498) for that.
Yes, and I guess I can close this one and wait for the outcome on that issue. Thanks for helping though.
This issue should be solved with v2.3.1 (https://github.com/liip/bootstrap-blocks-wordpress-plugin/releases/tag/2.3.1) of the plugin.
I created a plugin that has custom blocks for a certain website. But when I import a style.scss file and enqueue it. The Row and Button blocks from this plugin goes missing.
This is the error I get: Uncaught TypeError: Cannot read property 'call' of undefined at c (index.js?ver=130d186358a29f9f3f810962654c962a:1) at Module. (index.js?ver=130d186358a29f9f3f810962654c962a:1)
at c (index.js?ver=130d186358a29f9f3f810962654c962a:1)
at o (index.js?ver=130d186358a29f9f3f810962654c962a:1)
at index.js?ver=130d186358a29f9f3f810962654c962a:1
at index.js?ver=130d186358a29f9f3f810962654c962a:1
This happens only when I do wp-scripts build command.