You can get the custom or base URL of the store in a javascript(JS) file for the frontend area using the 'mage/url'
widgets.
You have to pass the 'mage/url'
widget as a dependency in a define([])
or require([])
function of the javascript file. Continue reading “How to get Custom, Base URL in JS file Magento 2?”