the replace function takes a substring and replaces each match in a string with it.
You do not need to replace anything, the URL is correctly formatted as it is.
const path = this.basePath + `/configurations/${id}/LicensePackageInfo`
works due to a concept called string interpolation.
In JavaScript, you can put variables values inside strings created with backticks ` wrapping them in the syntax ${}
you tried to replace.
const basePath = 'https://google.com'
const id = 10
const path = basePath + `/configurations/${id}/LicensePackageInfo`
console.log(path) // https://google.com/configurations/10/LicensePackageInfo
String interpolation example
const id = 10;
console.log(`my id is: ${id}`) //my id is: 10
console.log("my id is: ${id}") //my id is: ${id}
To read more on the concept https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals