1

I have a custom js which will be loaded every time in backend, i want to get the site base url without using phtml pure in js, for now i'm stuck in this:

 define(['mage/url'], 
      function (url) {
       'use strict';
        var baseurl = url.build('/sitename/namespace_module/test/index');
    });

which will give a result like this

http://127.0.0.1/sitename/namespace_module/test/index

the problem is, i have to define the sitename which is not flexible and correct for an extension, is there anyway to get the base url without using block and phtml file like this ?