Version: v5

getDirname

Convert a file:/// URL to an absolute directory path. This utility is particularly useful in ESM Rspack/webpack configs where __dirname is not available.

Parameters

fileUrl

  • Type: string
  • Required: true

The file:/// URL of a module, typically obtained from import.meta.url.

Example

Need React or React Native expertise you can count on?