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…

I tried this but I was not working because this is the solution for class that is defined with a namespace and in my case, the class is used with import / export. Did you know how to solve when it’s used with import / export?