Cannot use import statement outside a module

I need to override the below function from frappe app in to my custom app:
show_search_row() {
// show or remove search columns based on grid rows
this.show_search =
this.show_search && (this.grid?.data?.length >= 20 || this.grid.filter_applied);
!this.show_search && this.wrapper.remove();
return this.show_search;
}

that is in the class:
export default class GridRow { …

located at:
/home/xadmin/frappe-bench/apps/frappe/frappe/public/js/frappe/form/grid_row.js

I tried will multiple approaches but can’t find solution. An immediate response would be appriciated!

Use this approach… your js file must be built…