You should use @wordpress/scripts so you can profit from modern JavaScript language features and JSX and transpile it to browser-compatible code. It’s really not complicated to use.
Just install it via npm install @wordpress/scripts --save
and than you can transpile your source file like this wp-scripts build src/myguten.js.js --output--path=js
.
It’s not only modern language features but versioning and dependency management that comes with it too.
Related Posts:
- How to edit a post meta data in a Gutenberg Block?
- How do I access post meta data when publishing a new post in Gutenberg?
- How to store Gutenberg ColourPicker RGBA as metadata
- Copy content stored in meta to post content
- How to hide meta block(s) in certain post format
- Gutenberg: How to display meta field data in the block frontend (save function)
- Gutenberg featured image checkbox – checkbox not correctly set on editing page reload
- How do I manage custom meta in post revisions in the Block Editor era?
- How do I retrieve the slug of the current page?
- How to extract data from a post meta serialized array?
- How to save an array with one metakey in postmeta?
- WordPress is stripping escape backslashes from JSON strings in post_meta
- Lack of composite indexes for meta tables
- Content hooks vs User hooks
- Trying to get custom post meta through Jetpack JSON API [closed]
- Why time functions show invalid time zone when using ‘c’ time format?
- Why is get_post_meta returning an array when I specify it as single?
- Save both current and new version of post meta
- WP REST API “rest_no_route” when trying to update meta
- get_post_meta – get a single value
- What action hook updates post meta?
- get_post_meta / update_post_meta array
- Triple meta_key on custom SELECT query
- update_post_meta not adding anything.(Nor add_post_meta)
- Are multiple values from get_post_meta guaranteed to be ordered?
- Identifying Importer Posts
- How metadata API works?
- How to sanitize post meta field value?
- WordPress Action Hooks and Post ID?
- Post IDs missing on delete_postmeta action hook
- How trigger to save post when updating post meta
- Create a Metabox that behaves Like a Taxonomy Box
- Views count with time limit per IP
- order by multiple meta_keys?
- Save/update post_meta with Gutenberg from the panel
- Custom meta field don’t give me numerical value
- echo image caption
- get_*_meta doesn’t always return an array
- Generate multiple goo.gl shortlinks for qtranslate bilingual blog
- How can I convert postmeta from unserialized to serialized?
- add_post_meta adds meta to one more different post
- Custom query, multiple custom keys
- Trying to get property of non-object error using get_post_meta()
- How can I change the tag contents of individual WordPress posts?
- get_post_meta producing white screen of death
- update_post_meta not working in plugin
- how to get a list of meta data fields assocaited with a custom post type
- Look up all posts by status or meta value – performance difference
- Can A Post Meta Field Store multiple values that are not in an array?
- esc_attr on get_post_meta [closed]
- Sort custom posts in archive by multiple values: date AND meta key
- get_post_meta not working when variable used for post ID
- Looping inside block return
- Update post meta dynamically
- How do I edit the posted “by” and “on” in the post meta
- How to delete duplicate records in wp_postmeta database table?
- Need a SQL query to update meta_key=’_price’ with value in meta_key=’_regular_price’
- Display current user’s custom post meta in sidebar
- update_post_meta() adding bits in database [closed]
- Get posts ordered by meta data
- Displaying values from related field – if empty shows current post type’s link and title
- get_post_meta inside echo [closed]
- WordPress postmeta: Store data as an array or single item?
- Display Post Meta in Header
- Array of user ids to list of user names
- Conditional For get_the_author_meta
- Custom fields or something else
- Count Post and Page Views based on meta_value Using Shortcode in Dashboard Widget
- I want to Add Feedburner Right After Meta Details
- if get_post_meta function returns empty – Do Not Display HTML
- Custom column on CPT not showing correct value when meta data not set
- How to access post meta on the first time a post is published
- I Can’t get the post_tag name from term_id using wp_set_object_terms
- URL from get_post_meta() is broken my URL
- How to update/add child posts meta whenever the parent post meta is updated?
- WordPress Blocks, setAttributes not saving
- How to query post with meta?
- why is my postmeta table is so heavy
- update_post_meta() throws Uncaught error: Cannot create duplicate attribute
- Using a comma instead of a pipe to separate metadata
- Export media library with metadata and import into new blog
- Custom meta POST request fired twice when updating a post in Gutenberg
- show user based on user_meta
- Meta keys won’t add using wp_insert_post
- Re-pointing images to cloud storage
- undesrtanding get_post_meta function
- How Can I extract Image urls from post meta
- Twenty Twelve entry meta data – change and move
- How can I prevent the post_modified column in wp_posts from being updated?
- Sorting meta box values by start- and enddate and all dates in between
- Use an id on a button to update_post_meta in post
- get_post_meta image width for lazy load
- Write query according to post_meta
- Custom Fields help
- Why values dont shows in custom post column?
- get_post_meta of multiple posts?
- WP-API : post_meta not updated… but have another entry
- Parse error thrown by get_post_meta [closed]
- How to get all the related ids without array?
- Remove action of an external plugin after checking if custom post meta is set