One way to do this is to use import.meta.url and convert the file:// URI into a path-like string:
import.meta.url
file://
let uri = GLib.Uri.parse(import.meta.url, GLib.UriFlags.NONE); let fpath = uri.get_path(); print(`${fpath}`);