I have a global js variable defined below (@Url is an ASP.Net MVC html helper it will get converted to a string value):
A different approach would be to export your var, for ex:
export var API_ENDPOINT = '@Url.Action("Index","Home",new { Area = ""}, null)';
and then import that in your component
import {API_ENDPOINT }