node-cjs Provide __dirname and __filename for ESM packages. Installation npm npm install node-cjs yarn yarn add node-cjs Usage import cjs from "node-cjs"; const { __dirname, __filename } = cjs(import.meta);