I use the flag --experimental-modules when running my node application in order to use ES6 modules.
--experimental-modules
However when I use this flag the metavariable
As Geoff pointed out the following code returns not the module's path but working directory.
import path from 'path'; const __dirname = path.resolve();
works with --experimental-modules