ImportMeta.dirname - Web documentation
property ImportMeta.dirname

The absolute path of the directory containing the current module.

This property is only provided for local modules (ie. using file:// URLs).

  • Example:
// Unix
console.log(import.meta.dirname); // /home/alice

// Windows
console.log(import.meta.dirname); // C:\alice

Type

string