There is if you’re using Hugo Pipes to compile your script. You can add params to it which can later be invoked in the script.
basically you can call your script this way:
{{ $js := resources.Get "/js/indexjs" | js.Build (dict "params" (dict "baseurl" site.BaseURL")) }}
and then in your script:
import * as params from '@params';
console.log(params.baseurl)
More here