Deriving absolute directory or file path from import.meta with a consistent fallback order.
This function is Node.js-only and expects the url property to be a file: URL.
Fallbacks apply only to null or undefined, preserving explicitly supplied empty strings.
Deriving absolute directory or file path from import.meta with a consistent fallback order.
This function is Node.js-only and expects the
urlproperty to be afile:URL. Fallbacks apply only to null or undefined, preserving explicitly supplied empty strings.For type
'dir', the fallback order is:importMeta.dirname(if present)dirname(importMeta.filename)(if present)dirname(fileURLToPath(importMeta.url))For type
'file', the fallback order is:importMeta.filename(if present)fileURLToPath(importMeta.url)