Function getAbsoluteFileURL

  • Returns an absolute file URL, readable by the ESM loader.

    Parameters

    • baseURL: string

      The base URL of the module.

    • path: string[]

      The path to the target file.

    Returns URL

    The absolute file URL.

    Example

    // file:///absolute/path/to/src/index.js
    getAbsoluteFileURL(import.meta.url, ['src', 'index.js'])