node-compat-table icon indicating copy to clipboard operation
node-compat-table copied to clipboard

Add `import.meta.dirname` / `import.meta.filename` (available since node `20.11.0`)

Open 0xdevalias opened this issue 10 months ago • 0 comments

We can see more about when import.meta was introduced here:

  • https://github.com/nodejs/node/issues/47756
  • https://github.com/nodejs/node/pull/48740
    • Skimming through this PR, it seems import.meta.dirname/similar support was introduced in node 20.11.0

We can confirm that in the node docs, seeing that only import.meta.url / import.meta.resolve are available in node 19.x:

  • https://nodejs.org/docs/latest-v19.x/api/esm.html#importmeta

But from node 20.x+, import.meta.dirname / import.meta.filename are also available:

  • https://nodejs.org/docs/latest-v20.x/api/esm.html#importmeta

Originally posted by @0xdevalias in https://github.com/jehna/humanify/issues/343#issuecomment-2684169063

See also:

  • https://caniuse.com/?search=import.meta
  • https://github.com/mdn/content/issues/38335
  • https://github.com/mdn/browser-compat-data/issues/26066
  • https://github.com/williamkapke/node-compat-table/issues/7
  • https://github.com/compat-table/compat-table/issues/316
  • https://github.com/compat-table/compat-table/issues/1053
  • https://github.com/compat-table/compat-table/issues/1034
  • https://github.com/compat-table/compat-table/issues/1580

Tangentially related:

BCD has compat info for most if not all of the features you describe. See the compat tables on these pages:

We are working on a mechanism to better group features in collaboration with the web-platform-dx/feature-set project. Hopefully, there will be a group for all things modules soon.

Originally posted by @Elchi3 in https://github.com/mdn/browser-compat-data/issues/4819#issuecomment-1672805525

0xdevalias avatar Feb 26 '25 07:02 0xdevalias