Override number_card_widget.js

Hello Everyone,

I am trying to override the file named number_card_widget.js

This is my code:

import Widget from "./base_widget.js";

frappe.provide("frappe.utils");

export default class NumberCardWidget extends Widget {
	constructor(opts) {
		opts.shadow = true;
		super(opts);
	}
}

The path in hooks.py is

app_include_js = "/assets/migoo_crm/js/custom_number_card_widget.js"

But I’m getting errors while import and export classes and modules.

Screenshot from 2023-03-02 15-54-26

How can I override this file?

Thanks in Advance.

let FrappeDefaultNumberCard = frappe.widget.widget_factory.number_card;

class CustomNumberCard extends FrappeDefaultNumberCard {
render_number() {
console.log(“object”)
super.render_number();
}
}

frappe.widget.widget_factory.number_card = CustomNumberCard;

you can override the default number cards method like this