One of the things that I miss most about using ESM is the lack of __dirname and __filename. Here's how to recreate those variables....