Search
Convert a file:/// URL to an absolute directory path. This utility is particularly useful in ESM Rspack/webpack configs where __dirname is not available.
file:///
__dirname
type GetDirname = (fileUrl: string) => string;
string
true
The file:/// URL of a module, typically obtained from import.meta.url.
import.meta.url
import * as Repack from "@callstack/repack"; export default (env) => { const { context = Repack.getDirname(import.meta.url) } = env; return { // ... config }; };