Declaring object.prototype in js – VueRouter it automatically calls a method

I declared an extension method for objects by creating my own function. However, I do not call or import it anywhere. As a result, I get an exception. How can I fix this? I don’t recall such behavior in VUE 2.

Object.prototype.mergeObjXXXX = function(obj2){
     console.log(this);
     console.log(obj2);
}

vue 3.5.13
vue-router: 4.5.0

main.js:38 TypeError: Cannot convert undefined or null to object
    at Object.assign (<anonymous>)
    at Object.mergeObjXXXX (ext.js:20:9)
    at extractComponentsGuards (vue-router.js?v=ea680b7e:1465:32)
    at vue-router.js?v=ea680b7e:2484:16