What's in import.meta?
If you look at the import.meta docs on MDN you'll notice that it says:
The spec doesn't specify any properties to be defined on it, but hosts usually implement the following properties: [url, resolve]
So what is actually in there? MDN is correct in saying url and resolve are usually (always) implemented, but each run-time also sticks some other stuff in there. From my own testing, below are the values that exist for each major runtime.
Browsers
In my testing, Safari, Chrome, and Firefox all have the same import.meta. They don't add anything extra to MDN's listed properties:
url: A full URL to the current module file.resolve: a function that converts a relative module path to a URL using the current module's URL as a base.
MDN browser docs on import.meta.
Node.js
Node.js v22 has the following:
filename: the equivalent of CommonJS's__filenameorurl.fileURLToPath(import.meta.url).dirname: the equivalent of CommonJS's__dirnameorpath.dirname(import.meta.filename).resolve: the same as in browsers.url: the same as in browsers. Note that this uses afile://URL whiledirnameandfilenameare absolute paths (they start with/).
Deno
Deno v1.45 has the following:
main: a boolean indicating "whether the current module is the entry point to your program". This is the equivalent of CommonJS'srequire.main === modulecheck.filename: the same as in Node.js.dirname: the same as in Node.js.resolve: the same as in browsers.url: the same as in browsers.
Bun
Bun v1.1 has the following:
dir: the same asdirname.file: the same asfilename.path: the same asfilename.require: this is undocumented but appears to be CommonJS'srequirefunction.resolveSync: this is undocumented and is an synchronous version ofimport.meta.resolve. However, sinceimport.meta.resolveis no longer asynchronous, they're the same.env: a reference toprocess.env.main: the same as in Deno.filename: the same as in Node.js.dirname: the same as in Node.js.resolve: the same as in browsers.url: the same as in browsers.