I have created a custom block which uses
'enqueue_assets' => function() {
wp_enqueue_style( 'glidecss', get_template_directory_uri() . '/blocks/sliderglide/css/glide.min.css', [], '1.0' );
wp_enqueue_script( 'glidejs', get_template_directory_uri() . '/blocks/sliderglide/js/glide.min.js', ['jquery'], '1.0', true );
wp_enqueue_script( 'glide-launcher', get_template_directory_uri() . '/blocks/sliderglide/js/glide-launcher.js', ['glidejs'], '', true );
},
Now the problem is that this is loaded everywhere in the admin area which will results in an error because something is missing: TypeError: this.root is undefined glide.min.js:6:7415
How can I the resources only on gutenberg enabled admin pages?
The error prevents other JS to execute properly, for example The Meta Box Builder.