Function: getDirname
▸ getDirname(fileUrl
): string
Converts a file:///
URL to an absolute directory path.
Useful in ESM Webpack configs where __dirname
is unavailable.
Parameters
Name | Type | Description |
---|---|---|
fileUrl | string | The file:/// URL of a module. |
Returns
string
The directory path without the file:///
prefix.
Example
Usage in a Webpack ESM config:
import * as Repack from '@callstack/repack';
export default (env) => {
const {
context = Repack.getDirname(import.meta.url)
} = env;
};