Yes you can use the index.asset.php file in the ‘enqueue_block_editor_assets’ action. I guess you missed to npm install the dependencies you want to use and import them in your script. That’s how @wordpress/scripts generates your asset.php file. If you do not import the dependencies in your JavaScript files the dependency management of asset.php wont work.
For example:
npm install @wordpress/api-fetch --save
In your script:
import apiFetch from '@wordpress/api-fetch;
Related Posts:
- How to use wordpress default Password Strength Meter script
- Register and enqueue conditional (browser-specific) javascript files?
- wp_enqueue_script() not working at all
- Any advantage of using wp_scripts and is_IE when enqueuing scripts
- wp_enqueue_script : how to change loading order of scripts?
- Is there a core Sortable component in Gutenberg?
- wp_register_script multiple identifiers?
- require.js to load javascript
- Is there an equivalent of the PHP function sanitize_key in Gutenberg?
- wp_enqueue_script isn’t connecting my custom js file
- TinyMCE in a div / textarea on frontend?
- How do I enqueue(or delay loading of) tags in individual page posts?
- What do the args for Gutenberg subpackage “hooks” function “doAction” mean?
- How do I fire a snackbar notice in admin?
- Gutenberg Modify core taxonomy panel element via wp.hooks.addFilter
- Include Javascript as Plain (No file inclusion)
- What is “open()” in MediaUpload?
- Why is this gutenberg custom format button only available from the toolbar as a dropdown?
- Setting HTML properties in a Gutenberg plugin using WordPress settings
- Provide specific example for block variation
- Block editor: How to check if block editor has initialized and populated the data store?
- Is it mandatory to enqueue any kind of Javsacript?
- @wordpress/components Button variants not styled
- Gutenberg passing block attributes to component in ES6/ESNext
- How can I add Block Style support to the core HTML block in Gutenberg?
- How to place script in footer?
- can a buttongroup have a label?
- Enqueueing a script and a style sheet not working
- Adding a Javascript slideshow to the home page
- Is there a way to check for an attribute of a script when using script_loader_tag?
- InnerBlocks restricting does not work on nested blocks
- Gutenberg: Block validation Failed Richtext undefined
- Add custom HTML markup to Gutenberg RichText
- Enqueue scripts all over but not in single.php
- How to return div with custom attributes(Coding a Gutenberg Block)
- Media library not working with wp_editor() on the front end
- Get Block Attributes in JSON REST API
- Open Featured Image Modal in WordPress Gutenberg onClick of a button
- Override do_item() Function to Add Extra Attribute to Scripts
- Proper way to enqueue a generated script that isn’t in a .js file?
- Search for a keyword across post types in a Gutenberg component
- wp_enqueue_script not loading my custom js file
- Add custom classes for blocks in editor based on custom attributes
- Correctly enqueue scripts of type=text/paperscript (PaperJs Library)
- useSelect second parameter
- Video script issue, JavaScript attribute remains ‘undefined’
- Trigger wp-embed via JavaScript to refresh iframe preview?
- Gutenberg getBlockIndex in save() function
- Widgets and Post/Page edit/new blank, console errors only, no server errors
- Trying to turn the Edit function into a class to be able to use React lifecycle methods
- Do I just put the html in a page when enqueueng or do I also have to reference js file from the html page [closed]
- Gutenberg richtext block vaildation failed
- Conditional save return on Gutenberg Block
- Can I alter the block editor’s paste text behavior?
- Custom Gutenberg-Block esnext pass variables
- How to read inline-CSS from Gutenberg block?
- Custom Block – save.js function not saving attributes
- Javascript asset not enqueuing with the rest
- How do I know if I should enqueue JS code or just include it in ONE PHP function?
- Setting Variable Path to Template Directory inside Script
- wp_enqueue_script does not recognize my js file?
- What to include to use jQuery UI Auto Complete
- Bootstrap bundle present in page source but not working
- Dynamically add Js
- Is “document loaded” different on admin side than public side?
- How to pass data to javascript in custom widget class
- Custom block update rendering when reused
- WordPress Gutenberg Ajax request
- Loading two versions of same JS libary
- WP Gutenberg – custom block with two content fields
- Proper way of minifiying java script files in wordpress theme
- Adding javascript script to header via functions.php
- load-scripts.php loads incorrect file names
- Enqueue concatinated JS file in WordPress
- early enqueueing javascript file in page template, not in functions.php
- jQuery + more won’t load in header
- JS enqueue path (localhost)
- Why can’t I load JS script in a plugin?
- Script loaders vs wp_enqueue_script
- Block pattern conflict with custom block
- wp_enqueue has a resource but doesn’t generate a script tag [duplicate]
- Table block variation with header section activated
- Where to include JS library in gutenberg blocks
- How to load JavaScript modules with script_loader_tag hook?
- Uncaught ReferenceError: tippy is not defined
- How to securely set dynamic HTML content with JavaScript?
- Is it possible to add javascript to template parts
- How to add a new attribute to core wp block editor without npm?
- Create Youtube embed block with createBlock
- How to change the selected Template using javascript?
- config @wordpress/scripts with webpack and postCSS features
- How to build BOTH non-block components and blocks present in the /src directory using @wordpress/scripts
- Metabox conditionals depending on post format and template in Gutenberg
- How to re-render Gutenberg component when object instance is available
- How to access current discussion settings in gutenberg via JS?
- How to render HTML content using the Interactivity API?
- How to auto rename JS files to prevent browser cache issues
- How to get selected category objects in the block editor?
- How to render initial posts on page load in a Gutenberg block using the Interactivity API?
- How to include block style variations for blocks in posts dynamically rendered via the Interactivity API